Skip to content

--json incorrect output #431

@1zumiSagiri

Description

@1zumiSagiri

In the JSON output, success actually refers to the total number of test cases.

{
  "success": 3,
  "failures": 1,
  "time": 0.000047
}

To reproduce the error:

git clone https://github.com/mirage/alcotest.git
cd alcotest
opam install --deps-only .
dune exec ./examples/bad/bad.exe
dune exec ./examples/bad/bad.exe -- --json

The first exec output

alcotest % dune exec ./examples/bad/bad.exe 
Testing `First suite'.                

> [FAIL]        to_test          0   capitalise.
  [FAIL]        to_test          1   double all.
...
Full test results in `~/alcotest/_build/_tests/First suite'.
2 failures! in 0.000s. 2 tests run.Forging ahead regardless!

Testing `Second suite'.

  [OK]          Ωèone          0   Passing test 1.
> [FAIL]        Ωèone          1   Failing test.
  [OK]          Ωèone          2   Passing test 2.
...
Full test results in `~/alcotest/_build/_tests/Second suite'.
1 failure! in 0.000s. 3 tests run.
Fatal error: exception Alcotest_engine__Core.Make(P)(M).Test_error

The json exec output:

alcotest %  dune exec ./examples/bad/bad.exe -- --json 
Testing `First suite'.               
This run has ID `FSES0VEN'.

Forging ahead regardless!
{
  "success": 2,
  "failures": 2,
  "time": 0.000123
}
Testing `Second suite'.
This run has ID `S6H3PB7T'.

{
  "success": 3,
  "failures": 1,
  "time": 0.000065
}
Fatal error: exception Alcotest_engine__Core.Make(P)(M).Test_error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions