ExUnit.Formatter behaviour

This module simply defines the callbacks expected by an ExUnit.Formatter.

Source

Summary

format_filters(filters, type)

Formats filters used to constain cases to be run

format_test_case_failure(test_case, arg2, counter, color)

Receives a test case and formats its failure

format_test_failure(test_case, test, arg3, counter, color)

Receives a test and formats its failure

format_time(run_us, load_us)

Formats time taken running the test suite

Types

id :: term

run_us :: pos_integer

load_us :: pos_integer | nil

Functions

format_filters(filters, type)

Specs:

Formats filters used to constain cases to be run.

Examples

iex> format_filters([run: true, slow: false], :include) "Including tags: [run: true, slow: false]"

Source
format_test_case_failure(test_case, arg2, counter, color)

Receives a test case and formats its failure.

Source
format_test_failure(test_case, test, arg3, counter, color)

Receives a test and formats its failure.

Source
format_time(run_us, load_us)

Specs:

Formats time taken running the test suite.

It receives the time spent running the tests and optionally the time spent loading the test suite.

Examples

iex> format_time(10000, nil)
"Finished in 0.01 seconds"

iex> format_time(10000, 20000)
"Finished in 0.03 seconds (0.02s on load, 0.01s on tests)"

iex> format_time(10000, 200000)
"Finished in 0.2 seconds (0.2s on load, 0.01s on tests)"
Source

Callbacks

case_finished(id, test_case)

Specs:

Source
case_started(id, test_case)

Specs:

Source
suite_finished(id, run_us, load_us)

Specs:

Source
suite_started(opts)

Specs:

  • suite_started(opts :: []) :: id
Source
test_finished(id, test)

Specs:

  • test_finished(id, test) :: any
Source
test_started(id, test)

Specs:

  • test_started(id, test) :: any
Source