Surfex.ExUnitFormatter (Surfex v0.6.2)

Copy Markdown View Source

An ExUnit formatter that records test evidence (Surfex.Evidence): for each test that ran, whether it passed, at its exact version, with the versions of the code it calls.

Add it beside the usual formatter, in test/test_helper.exs:

ExUnit.start(formatters: [ExUnit.CLIFormatter, Surfex.ExUnitFormatter])

At the start of the suite it scans the project as mix surfex.status does: the tests tests: names in .surfex.exs, and the code. A finished test is matched to its scanned record by file and line, so a test a comprehension generates counts for the record that defines it. When a record's test ran more than once in a run (one per case), it failed if any case failed. An excluded or skipped test is recorded as such, with no code versions, so a run that leaves a test out is told apart from one where it didn't run. Invalid tests, and tests outside tests:, record nothing. When the suite finishes, the run's records are appended to Surfex.Evidence.path/1 under _build: scratch data, never committed.

It never touches the relation log. Evidence justifies confirmations only when someone asks for them (mix surfex.confirm --evidence).

Summary

Functions

Returns a specification to start this module under a supervisor.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.