diff options
author | Loïc Hoguin <[email protected]> | 2018-12-07 14:45:07 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2018-12-07 14:45:07 +0100 |
commit | 1a6311a3a4933e767ba057780cefe1600f50f5c3 (patch) | |
tree | ba70a268baba369d41fe9c0d80f50bf82ebd0338 /guide/ct.html | |
parent | 5da193f4a6f60ecf8ff4c5f748fa74c872ef361e (diff) | |
download | erlang.mk-1a6311a3a4933e767ba057780cefe1600f50f5c3.tar.gz erlang.mk-1a6311a3a4933e767ba057780cefe1600f50f5c3.tar.bz2 erlang.mk-1a6311a3a4933e767ba057780cefe1600f50f5c3.zip |
Update user guide
Diffstat (limited to 'guide/ct.html')
-rw-r--r-- | guide/ct.html | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/guide/ct.html b/guide/ct.html index 141c668..d0b588a 100644 --- a/guide/ct.html +++ b/guide/ct.html @@ -33,13 +33,13 @@ div.navfooter{margin-bottom:1em} </header> <main> -<div class="navheader"><table width="100%" summary="Navigation header"><tr><td width="20%" align="left"><a accesskey="p" href="eunit.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="triq.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="ct"></a>Chapter 19. Common Test</h2></div></div></div><p>Common Test is Erlang’s functional testing framework. +<div class="navheader"><table width="100%" summary="Navigation header"><tr><td width="20%" align="left"><a accesskey="p" href="eunit.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="triq.html">Next</a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a id="ct"></a>Chapter 20. Common Test</h2></div></div></div><p>Common Test is Erlang’s functional testing framework. Erlang.mk automates the discovery and running of Common -Test suites.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_writing_tests_2"></a>19.1. Writing tests</h2></div></div></div><p>The <a class="ulink" href="http://www.erlang.org/doc/apps/common_test/write_test_chapter.html" target="_top">Common Test user guide</a> +Test suites.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_writing_tests_2"></a>20.1. Writing tests</h2></div></div></div><p>The <a class="ulink" href="http://www.erlang.org/doc/apps/common_test/write_test_chapter.html" target="_top">Common Test user guide</a> is the best place to learn how to write tests. Erlang.mk requires that file names for test suites end with <span class="emphasis"><em>_SUITE.erl</em></span> and that the files be located in the <span class="emphasis"><em>$(TEST_DIR)</em></span> directory. -This defaults to <span class="emphasis"><em>test/</em></span>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_configuration_7"></a>19.2. Configuration</h2></div></div></div><p>The <code class="literal">CT_OPTS</code> variable allows you to set extra Common Test +This defaults to <span class="emphasis"><em>test/</em></span>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_configuration_7"></a>20.2. Configuration</h2></div></div></div><p>The <code class="literal">CT_OPTS</code> variable allows you to set extra Common Test options. Options are documented in the <a class="ulink" href="http://www.erlang.org/doc/apps/common_test/run_test_chapter.html" target="_top">Common Test user guide</a>. You can use it to set Common Test hooks, for example:</p><pre class="programlisting">CT_OPTS = -ct_hooks cowboy_ct_hook</pre><p>The <code class="literal">CT_SUITES</code> variable can be used to override what @@ -48,7 +48,7 @@ not normally need to be set as Erlang.mk will find the test suites automatically.</p><p>The name of the suite is the part before <code class="literal">_SUITE.erl</code>. If the file is named <span class="emphasis"><em>http_SUITE.erl</em></span>, the test suite is <code class="literal">http</code>:</p><pre class="programlisting">CT_SUITES = http ws</pre><p>The <code class="literal">CT_LOGS_DIR</code> variable can be used to set where HTML -log files are to be written. This defaults to <span class="emphasis"><em>logs/</em></span>.</p><pre class="programlisting">CT_LOGS_DIR = ct_output_log_dir</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_usage_5"></a>19.3. Usage</h2></div></div></div><p>To run all tests (including Common Test):</p><pre class="programlisting">$ make tests</pre><p>To run all tests and static checks (including Common Test):</p><pre class="programlisting">$ make check</pre><p>You can also run Common Test separately:</p><pre class="programlisting">$ make ct</pre><p>Erlang.mk will create targets for all test suites it finds. +log files are to be written. This defaults to <span class="emphasis"><em>logs/</em></span>.</p><pre class="programlisting">CT_LOGS_DIR = ct_output_log_dir</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_usage_5"></a>20.3. Usage</h2></div></div></div><p>To run all tests (including Common Test):</p><pre class="programlisting">$ make tests</pre><p>To run all tests and static checks (including Common Test):</p><pre class="programlisting">$ make check</pre><p>You can also run Common Test separately:</p><pre class="programlisting">$ make ct</pre><p>Erlang.mk will create targets for all test suites it finds. If you have a file named <span class="emphasis"><em>test/http_SUITE.erl</em></span>, then the target <code class="literal">ct-http</code> will run that specific test suite:</p><pre class="programlisting">$ make ct-http</pre><p>Erlang.mk provides a convenient way to run a specific group or a specific test case within a specific group, @@ -57,7 +57,7 @@ suite-specific targets, like the <code class="literal">ct-http</code> example ab <code class="literal">http_SUITE</code> test suite, write:</p><pre class="programlisting">$ make ct-http t=http_compress</pre><p>Similarly, to run a specific test case in that group:</p><pre class="programlisting">$ make ct-http t=http_compress:headers_dupe</pre><p>To do the same against a multi-application repository, you can use the <code class="literal">-C</code> option:</p><pre class="programlisting">$ make -C apps/my_app ct-http t=my_group:my_case</pre><p>Note that this also applies to dependencies. When using Cowboy as a dependency, you can run the following directly:</p><pre class="programlisting">$ make -C deps/cowboy ct-http t=http_compress</pre><p>The variable <code class="literal">c</code> can be used to run a specific test when -the test suite does not group test cases:</p><pre class="programlisting">$ make ct-http c=headers_dupe</pre><p>Finally, <a class="link" href="coverage.html" title="Chapter 21. Code coverage">code coverage</a> is available, +the test suite does not group test cases:</p><pre class="programlisting">$ make ct-http c=headers_dupe</pre><p>Finally, <a class="link" href="coverage.html" title="Chapter 22. Code coverage">code coverage</a> is available, but covered in its own chapter.</p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="eunit.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="tests.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="triq.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> </td></tr></table></div> </main> </body> |