Exkorpion v0.0.3 API Reference
Modules
The purpose of this module is display by console the resume for the scenarios execution
Report Handler GenServer
Runs the tests for a project.
This task starts the current application, loads up
test/scenario_helper.exs
and then requires all files matching the
test/**/_test.exs
pattern in parallel.
A list of files can be given after the task name in order to select
the files to compile:
mix test test/some/particular/file_test.exs
Command line options
--trace
- run tests with detailed reporting; automatically sets--max-cases
to 1--max-cases
- set the maximum number of cases running async--cover
- the directory to include coverage results--raise
- raise if the test suit failed--force
- forces compilation regardless of modification times--no-compile
- do not compile, even if files require compilation--no-start
- do not start applications after compilation--no-color
- disable color in the output--color
- enable color in the output--include
- include tests that match the filter--exclude
- exclude tests that match the filter--only
- run only tests that match the filter--seed
- seeds the random number generator used to randomize tests order;--seed 0
disables randomization--timeout
- set the timeout for the tests--no-deps-check
- do not check dependencies--no-archives-check
- do not check archives--no-elixir-version-check
- do not check the Elixir version from mix.exs--stale
- run only tests which reference modules that changed since the lasttest --stale
. You can read more about this option in the “Stale” section below.--listen-on-stdin
- run tests, and then listen on stdin. Receiving a newline will result in the tests being run again. Very useful when combined with--stale
and external commands which produce output on stdout upon file system modification.
Filters
ExUnit provides tags and filtering functionality that allows developers to select which tests to run. The most common functionality is to exclude some particular tests from running by default in your test helper file:
# Exclude all external tests from running
ExUnit.configure exclude: [external: true]
Then, whenever desired, those tests could be included in the run via the
--include
flag:
mix test --include external:true
The example above will run all tests that have the external flag set to
true
. It is also possible to include all examples that have a given tag,
regardless of its value:
mix test --include external
Note that all tests are included by default, so unless they are excluded
first (either in the test helper or via the --exclude
option), the
--include
flag has no effect.
For this reason, Mix also provides an --only
option that excludes all
tests and includes only the given ones:
mix test --only external
Which is equivalent to:
mix test --include external --exclude test
In case a single file is being tested, it is possible pass a specific line number:
mix test test/some/particular/file_test.exs:12
Which is equivalent to:
mix test --only line:12 test/some/particular/file_test.exs
Note that line filter takes the closest test on or before the given line number. In the case a single file contains more than one test module (test case), line filter applies to every test case before the given line number, thus more than one test might be taken for the run.
Configuration
:scenario_paths
- list of paths containing test files, defaults to["test"]
. It is expected all test paths to contain ascenario_helper.exs
file.:scenario_pattern
- a pattern to load test files, defaults to*_test.exs
.:warn_scenario_pattern
- a pattern to match potentially missed test files and display a warning, defaults to*_test.ex
.:scenario_coverage
- a set of options to be passed down to the coverage mechanism.
Coverage
The :scenario_coverage
configuration accepts the following options:
:output
- the output for cover results, defaults to"cover"
:tool
- the coverage tool By default, a very simple wrapper around OTP’scover
is used as a tool, but it can be overridden as follows: scenario_coverage: [tool: CoverModule]CoverModule
can be any module that exportsstart/2
, receiving the compilation path and thescenario_coverage
options as arguments. It must return an anonymous function of zero arity that will be run after the test suite is done ornil
.
“Stale”
The --stale
command line option attempts to run only those test files which
reference modules that have changed since the last time you ran this task with
--stale
.
The first time this task is run with --stale
, all tests are run and a manifest
is generated. On subsequent runs, a test file is marked “stale” if any modules it
references (and any modules those modules reference, recursively) were modified
since the last run with --stale
. A test file is also marked “stale” if it has
been changed since the last run with --stale