× {{alert.msg}} Never ask again
Get notified about new tutorials RECEIVE NEW TUTORIALS

Meta-Test your Erlang Code

Brujo Benavides
Apr 19, 2016
<h2>Intro</h2> <p>If you use <a href="http://erlang.org/doc/apps/common_test/basics_chapter.html">common_test</a> to test your code, you can also <em><a href="http://inaka.net/blog/2015/07/17/erlang-meta-test/">meta</a>-<a href="http://inaka.net/blog/2015/11/13/erlang-meta-test-revisited/">test</a></em> it (i.e. verify not only that your code works, but that it's properly written) using a simple test suite provided by <a href="http://github.com/inaka/katana-test">katana-test</a>.</p> <h2>HowTo</h2> <p>First you need to add <a href="http://github.com/inaka/katana-test">katana-test</a> and <a href="https://github.com/chef/mixer">mixer</a> to your dependencies. You can use rebar3, erlang.mk or your favourite tool for that. Then just create a meta_SUITE module like this one:</p> <pre><code>-module(meta_SUITE). -include_lib("mixer/include/mixer.hrl"). -mixin([ktn_meta_SUITE]). -export([init_per_suite/1]). init_per_suite(Config) -&gt; [{application, your_app} | Config]. </code></pre> <p>There are more options and you can restrict the list of testcases. To learn about that, check <a href="http://github.com/inaka/katana-test">katana-test's repo in github</a> :)</p>
comments powered by Disqus