From b5d4cb91f80c833795a2d87050c3674bb7aecdc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Tue, 3 Oct 2017 13:39:41 +0200 Subject: Update Hugo, docs --- docs/en/erlang.mk/1/guide/common_test/index.html | 235 ++++++++++++----------- 1 file changed, 125 insertions(+), 110 deletions(-) (limited to 'docs/en/erlang.mk/1/guide/common_test') diff --git a/docs/en/erlang.mk/1/guide/common_test/index.html b/docs/en/erlang.mk/1/guide/common_test/index.html index 74e9c912..7933d41a 100644 --- a/docs/en/erlang.mk/1/guide/common_test/index.html +++ b/docs/en/erlang.mk/1/guide/common_test/index.html @@ -7,7 +7,7 @@ - + Nine Nines: Common Test @@ -67,121 +67,136 @@

Common Test

-

Common Test is Erlang’s functional testing framework. -Erlang.mk automates the discovery and running of Common -Test suites.

-
-

Writing tests

-
-

The Common Test user guide -is the best place to learn how to write tests. Erlang.mk -requires that file names for test suites end with _SUITE.erl -and that the files be located in the $(TEST_DIR) directory. -This defaults to test/.

-
-
-
-

Configuration

-
-

The CT_OPTS variable allows you to set extra Common Test -options. Options are documented in the -Common Test user guide. -You can use it to set Common Test hooks, for example:

-
-
-

The CT_SUITES variable can be used to override what -Common Test suites Erlang.mk will be aware of. It does -not normally need to be set as Erlang.mk will find the -test suites automatically.

-

The name of the suite is the part before _SUITE.erl. -If the file is named http_SUITE.erl, the test suite -is http:

-
-
-

The CT_LOGS_DIR variable can be used to set where HTML -log files are to be written. This defaults to logs/.

-
-
-
-
-
-

Usage

-
-

To run all tests (including Common Test):

-
-
-
$ make tests
-

To run all tests and static checks (including Common Test):

-
-
-
$ make check
-

You can also run Common Test separately:

-
-
-
$ make ct
-

Erlang.mk will create targets for all test suites it finds. -If you have a file named test/http_SUITE.erl, then the -target ct-http will run that specific test suite:

-
-
-
$ make ct-http
-

Erlang.mk provides a convenient way to run a specific -group or a specific test case within a specific group, -using the variable t. Note that this only applies to -suite-specific targets, like the ct-http example above.

-

To run all tests from the http_compress group in the -http_SUITE test suite, write:

-
-
-
$ make ct-http t=http_compress
-

Similarly, to run a specific test case in that group:

-
-
-
$ make ct-http t=http_compress:headers_dupe
-

To do the same against a multi-application repository, -you can use the -C option:

-
-
-
$ make -C apps/my_app ct-http t=my_group:my_case
-

Note that this also applies to dependencies. When using Cowboy -as a dependency, you can run the following directly:

-
-
-
$ make -C deps/cowboy ct-http t=http_compress
-

Finally, code coverage is available, -but covered in its own chapter.

-
-
+

Common Test is Erlang’s functional testing framework. +Erlang.mk automates the discovery and running of Common +Test suites.

+
+

Writing tests

+
+

The Common Test user guide +is the best place to learn how to write tests. Erlang.mk +requires that file names for test suites end with _SUITE.erl +and that the files be located in the $(TEST_DIR) directory. +This defaults to test/.

+
+
+
+

Configuration

+
+

The CT_OPTS variable allows you to set extra Common Test +options. Options are documented in the +Common Test user guide. +You can use it to set Common Test hooks, for example:

+
+
+
CT_OPTS = -ct_hooks cowboy_ct_hook
+

The CT_SUITES variable can be used to override what +Common Test suites Erlang.mk will be aware of. It does +not normally need to be set as Erlang.mk will find the +test suites automatically.

+

The name of the suite is the part before _SUITE.erl. +If the file is named http_SUITE.erl, the test suite +is http:

+
+
+
CT_SUITES = http ws
+

The CT_LOGS_DIR variable can be used to set where HTML +log files are to be written. This defaults to logs/.

+
+
+
CT_LOGS_DIR = ct_output_log_dir
+
+
+
+

Usage

+
+

To run all tests (including Common Test):

+
+
+
$ make tests
+

To run all tests and static checks (including Common Test):

+
+
+
$ make check
+

You can also run Common Test separately:

+
+
+
$ make ct
+

Erlang.mk will create targets for all test suites it finds. +If you have a file named test/http_SUITE.erl, then the +target ct-http will run that specific test suite:

+
+
+
$ make ct-http
+

Erlang.mk provides a convenient way to run a specific +group or a specific test case within a specific group, +using the variable t. Note that this only applies to +suite-specific targets, like the ct-http example above.

+

To run all tests from the http_compress group in the +http_SUITE test suite, write:

+
+
+
$ make ct-http t=http_compress
+

Similarly, to run a specific test case in that group:

+
+
+
$ make ct-http t=http_compress:headers_dupe
+

To do the same against a multi-application repository, +you can use the -C option:

+
+
+
$ make -C apps/my_app ct-http t=my_group:my_case
+

Note that this also applies to dependencies. When using Cowboy +as a dependency, you can run the following directly:

+
+
+
$ make -C deps/cowboy ct-http t=http_compress
+

Finally, code coverage is available, +but covered in its own chapter.

+
+
+ + +