Open mjambon opened 1 year ago
I did a bit of work toward these goals. This is a lot of code (~2000 lines), all of it as a layer on top of the Alcotest library. The code, for now, is kept within the semgrep project at https://github.com/semgrep/semgrep/tree/develop/libs/alcotest_ext. Given its size and complexity, it should probably not be merged into the main Alcotest project but I'm still up for it. The current status is "alpha" in the sense that many features will need to be adjusted after we use it. The visual output is a bit of a mess.
Here's what was implemented and works:
run
, status
, approve
. All 3 write or read the status of tests stored on disk.run --lazy
: only reruns the tests that previously failed. Useful when working on fixing a small number of tests.run -s d84498857f5e
.Unchanged:
Alcotest.check
and accompanying functions (or whatever exception-raising checks the user likes).Partially implemented:
--lazy
is another form of filtering that's usable. Filtering by tags and combining all this in a unified boolean query language may be a good idea in addition to shortcut options such as --lazy
or --tags
.Unavailable:
The project is now known as "Testo" and has its own repo: https://github.com/semgrep/testo. We're using it in Semgrep.
Hi. I'm looking into adding functionality to our test suite. We'll be porting tests from Pytest to Ocaml and we'll need a convenient way to check stdout and stderr outputs. I'm not sure what the implementation would look like. At best, it extends the command-line interface generated by alcotest without breaking existing code. At worst, it's some custom code in our (open-source) project that nobody else can use conveniently.
Here's what I have in mind:
Subcommands offered by the generated test program
run
(today known astest
): run the testslist
: list the tests - shows the names, identifiers, or tags that can be used to filter testsstatus
*: show the status of the last run for each test - OK, FAIL, XFAIL, XPASS, or Unknownapprove
*: approve the output of the last run for the selected tests, similar todune promote
andpytest --snapshot-update
without rerunning the testsrerun
*: rerun the failed tests (and those that haven't run)* new subcommand
All these subcommands support filters that restrict the selection of tests. Filtering can be done:
some_product and not todo
Library changes
Please let me know if there's already something we can use that supports capturing stdout/stderr and the
status
andapprove
subcommand.Other requirements