package junit_alcotest
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=fda941b653613a4a5731f9b3557364b12baa341daa13c01676c9eb8d64e96b01
sha512=5a9fa803c4861748bb8482fc51197420bf3cc3b9540989a489c4ffb65fdd02386aaa60437eae29182209dae0903b0e537c095249e19d395a451b8e8214f15f03
doc/junit_alcotest/Junit_alcotest/index.html
Module Junit_alcotest
Source
Interface to product JUnit reports for Alcotest
It tries to provide a layer as thin as possible on top of Alcotest to allow to port existing test without writing a lot a boilerplate.
val wrap_test :
?classname:string ->
(Junit.Testcase.t -> unit) ->
unit Alcotest.test_case ->
unit Alcotest.test_case
wrap_test handle_result test_cases
wraps test cases to create Junit testcases and pass them to handle_result
.
Can be used with run
to create customized Junit testsuites if the output of run_and_report
is not as expected.
run ?argv n t
is a wrapper around Alcotest.run
, only setting and_exit
to false. It is mandatory to be able to process results after the end of the run.
Low level function. It is easier to use run_and_report
.
exit ()
exists with appropriate code if run_and_report
's and_exit
was true
or raise Alcotest.Test_error
in case of error.
val run_and_report :
?and_exit:bool ->
?package:string ->
?timestamp:Ptime.t ->
?argv:string array ->
string ->
(string * unit Alcotest.test_case list) list ->
Junit.Testsuite.t * exit
run name tests
is a wrapper around run
and wrap_test
. It runs the tests and creates a Junit testsuite from the results.
As Alcotest.run
is always called with and_exit = false
to be able to produce a report, the behavior is emulated by the returned exit
function.
The optional argument and_exit
controls what happens when the exit
function is called. By default, and_exit
is set, which makes the function exit with 0
if everything is fine or 1
if there is an issue. If and_exit
is false
, then the function raises Test_error
on error.
?argv
is forwarded to run
. ?package
and ?timestamp
are forwarded to Junit.Testsuite.make
.