Instead of using this tool, consider adding a test
alias to your rebar.config
, like this:
{alias,
[{test, [compile, format, lint, hank, dialyzer, {ct, "--verbose"}, cover, edoc]}]}.
That way, you can run rebar3 test
on your CI pipelines and get the code checked with all the desirable tools/plugins at once.
Old Readme
Katana Test is an Erlang library application containing modules useful for testing Erlang systems. It currently contains the module `ktn_meta_SUITE`, which is a Common Test suite to be included among your tests. Read below for more information.If you find any bugs or have a problem while using this library, please open an issue in this repo (or a pull request :)).
And you can check all of our open-source projects at inaka.github.io
The meta suite lets you check your code with dialyzer
, xref
and elvis
.
To include the suite in your project, you only need to invoke its functions from a common_test suite. If you use mixer you can do…
-module(your_meta_SUITE).
-include_lib("mixer/include/mixer.hrl").
-mixin([ktn_meta_SUITE]).
-export([init_per_suite/1, end_per_suite/1]).
init_per_suite(Config) -> [{application, your_app} | Config].
end_per_suite(_) -> ok.
Of course, you can choose what functions to include, for example if you want dialyzer
but not elvis
nor xref
you can do…
-mixin([{ ktn_meta_SUITE
, [ dialyzer/1
]
}]).
-export([all/0]).
all() -> [dialyzer].
ktn_meta_SUITE
uses the following configuration parameters that you can add to the common_test config for your test suite:
Parameter | Description | Default |
---|---|---|
base_dir |
The base_dir for your app | code:lib_dir(App) where App is what you define in application below |
application |
The name of your app | no default |
dialyzer_warnings |
The active warnings for diaylzer | [error_handling, race_conditions, unmatched_returns, unknown] |
plts |
The list of plt files for dialyzer | filelib:wildcard("your_app/*.plt") |
elvis_config |
Config file for elvis | "your_app/elvis.config" |
xref_config |
Config options for xref | #{dirs => [filename:join(BaseDir, "ebin"), filename:join(BaseDir, "test")], xref_defaults => [{verbose, true}, {recurse, true}, {builtins, true}]} |
xref_checks |
List of checks for xref | [ undefined_function_calls, locals_not_used, deprecated_function_calls] |
dirs |
List of folders to check with xref and dialyzer | ["ebin", "test"] |