Is anybody outputting junit reports and integrating them with some CI system? If so, which OCaml testing libraries are you using?
I set up alcotest and junit_alcotest, hereās the main test code: re-web/ReWebTest.ml at 7b407c1b98ddfac32a81c32481c40cc535c7452a Ā· yawaramin/re-web Ā· GitHub
CI tools like like Azure Pipelines (which Iām using for this project) can pick up the junit.xml
file that gets produced during the build and, and report the results. Iāve verified this personally, although sadly Azure has lost past test run results due to some flakiness.
I use oth
, which needs a refresh in opam, which outputs TAP
I used to do that, using OUnit directly, I think. The junit
library
can also be useful to output results by hand.
Iām using junit_alcotest
and Github Actions
the reports get written to _build/default/tests/<filename>
which can be specified in the test like Junit.to_file report "<filename>"
the action looks like:
steps:
- uses: actions/checkout@v2
- uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: 4.12.x
- run: opam install . --deps-only --with-test
- run: opam exec -- dune test --force
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v1
if: always()
with:
check_name: Dune unit test results
comment_on_pr: false
files: _build/default/tests/junit-*.xml
test failures are reported as āannotationsā in the actions UI
Out of curiosity, when JUnit format could be useful?
CI tools like GitHub/etc. understand JUnit format and present it in their UIs with nice rendering.
Ah, OK. I forgot that running all tests on local machine may be costly and biased.
It is also not great if you want to accept PRs, then you have to check out the branches locally that they pass the tests and so must all contributors remember to run the tests. Generally a rather fragile setup prone to someone forgetting and then having broken code committed.