package junit_alcotest

  1. Overview
  2. Docs
JUnit XML reports generation for alcotest tests

Install

Dune Dependency

Authors

Maintainers

Sources

junit-2.0.2.tbz
sha256=fda941b653613a4a5731f9b3557364b12baa341daa13c01676c9eb8d64e96b01
sha512=5a9fa803c4861748bb8482fc51197420bf3cc3b9540989a489c4ffb65fdd02386aaa60437eae29182209dae0903b0e537c095249e19d395a451b8e8214f15f03

doc/junit_alcotest/Junit_alcotest/index.html

Module Junit_alcotestSource

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.

Sourceval 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.

  • parameter classname

    will populate the 'classname' attribute for the test case. For best hierarchic rendering in Jenkins, it should contain a period. For example, "foo.bar.baz" will be rendered a package "foo.bar" that contains a class "baz", which contains the current test case and others. Defaults to the name of the test case.

Sourceval run : ?argv:string array -> string -> unit Alcotest.test list -> unit

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.

Sourcetype exit = unit -> unit

exit () exists with appropriate code if run_and_report's and_exit was true or raise Alcotest.Test_error in case of error.

Sourceval 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.

OCaml

Innovation. Community. Security.