Home

Awesome

katana-test

⚠ THIS REPO IS ARCHIVED ⚠️

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.

<details><summary>Old Readme</summary> 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.

Contact Us

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

ktn_meta_SUITE

Goals

The meta suite lets you check your code with dialyzer, xref and elvis.

Usage

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].

Configuration

ktn_meta_SUITE uses the following configuration parameters that you can add to the common_test config for your test suite:

ParameterDescriptionDefault
base_dirThe base_dir for your appcode:lib_dir(App) where App is what you define in application below
applicationThe name of your appno default
dialyzer_warningsThe active warnings for diaylzer[error_handling, race_conditions, unmatched_returns, unknown]
pltsThe list of plt files for dialyzerfilelib:wildcard("your_app/*.plt")
elvis_configConfig file for elvis"your_app/elvis.config"
xref_configConfig options for xref#{dirs => [filename:join(BaseDir, "ebin"), filename:join(BaseDir, "test")], xref_defaults => [{verbose, true}, {recurse, true}, {builtins, true}]}
xref_checksList of checks for xref[ undefined_function_calls, locals_not_used, deprecated_function_calls]
dirsList of folders to check with xref and dialyzer["ebin", "test"]
</details>