Skip to content
This repository has been archived by the owner on Feb 17, 2023. It is now read-only.
/ caravan Public archive

A framework for stateful, black-box testing of arbitrary systems, in OCaml. Inspired by Erlang/OTP's Common Test.

License

Notifications You must be signed in to change notification settings

xandkar/caravan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

caravan

A framework for black-box testing of arbitrary systems, in OCaml. Inspired by Erlang/OTP's "Common Test".

Status

Prototype. Already useful, but API is expected to frequently change (within rules of semver!). For instance, see Issue 11.

Example

Simple example, from examples/hello, which does not actually use state or does any IO; for an example that does - see: examples/riak_crud.

A test case fails if it raises any exception. Log messages with level info are always reported, while debug messages only show-up if the test case fails.

open Core.Std
open Async.Std

module Log  = Caravan.Log
module Test = Caravan.Test

let test_hello_pass =
  let case () ~log =
    Log.info  log "Info level is always reported.";
    Log.debug log "Asserting 2 + 2 = 4";
    assert (2 + 2 = 4);
    return ()
  in
  {Test.id = "test_hello_pass"; case; children = []}

let test_hello_fail =
  let case () ~log =
    Log.debug log "Asserting 2 + 2 = 5";
    assert (2 + 2 = 5);
    return ()
  in
  {Test.id = "test_hello_fail"; case; children = []}

let main () =
  let tests =
    [ test_hello_pass
    ; test_hello_fail
    ]
  in
  Caravan.run ~tests ~init_state:()

let () =
  don't_wait_for (main ());
  never_returns (Scheduler.go ())

1 pass, 1 fail

About

A framework for stateful, black-box testing of arbitrary systems, in OCaml. Inspired by Erlang/OTP's Common Test.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published