From 0634077b636eb0c879e1f71ba78ea1565b6617b2 Mon Sep 17 00:00:00 2001 From: Peter Andersson Date: Tue, 19 Apr 2011 16:54:46 +0200 Subject: Document the new init_per_testcase return value. --- lib/common_test/doc/src/common_test_app.xml | 12 +++++++----- lib/common_test/doc/src/write_test_chapter.xml | 12 ++++++++---- 2 files changed, 15 insertions(+), 9 deletions(-) (limited to 'lib/common_test/doc') diff --git a/lib/common_test/doc/src/common_test_app.xml b/lib/common_test/doc/src/common_test_app.xml index 1ee73b890b..c92566de37 100644 --- a/lib/common_test/doc/src/common_test_app.xml +++ b/lib/common_test/doc/src/common_test_app.xml @@ -296,7 +296,7 @@ - Module:init_per_testcase(TestCase, Config) -> NewConfig | {skip,Reason} + Module:init_per_testcase(TestCase, Config) -> NewConfig | {fail,Reason} | {skip,Reason} Test case initialization. TestCase = atom() @@ -311,10 +311,12 @@

This function is called before each test case. The TestCase argument is the name of the test case, and - Config is the configuration which can be modified - here. Whatever is returned from this function is given as - Config to the test case. If {skip,Reason} is returned, - the test case will be skipped and Reason printed + Config (list of key-value tuples) is the configuration + data that can be modified here. The NewConfig list returned + from this function is given as Config to the test case. + If {fail,Reason} is returned, the test case is + marked as failed without being executed. If {skip,Reason} is + returned, the test case will be skipped and Reason printed in the overview log for the suite.

diff --git a/lib/common_test/doc/src/write_test_chapter.xml b/lib/common_test/doc/src/write_test_chapter.xml index 723492d8f3..3f9fdb7121 100644 --- a/lib/common_test/doc/src/write_test_chapter.xml +++ b/lib/common_test/doc/src/write_test_chapter.xml @@ -167,12 +167,16 @@ returning {fail,Reason}, nor will it be able to save data with {save_config,Data}.

-

If init_per_testcase crashes, the test case itself is skipped +

If init_per_testcase crashes, the test case itself gets skipped automatically (so called auto skipped). If init_per_testcase - returns a skip tuple, also then will the test case be skipped (so - called user skipped). In either event, the end_per_testcase is - never called. + returns a tuple {skip,Reason}, also then the test case gets skipped + (so called user skipped). It is also possible, by returning a tuple + {fail,Reason} from init_per_testcase, to mark the test case + as failed without actually executing it.

+

If init_per_testcase crashes, or returns {skip,Reason} + or {fail,Reason}, the end_per_testcase function is not called. +

If it is determined during execution of end_per_testcase that the status of a successful test case should be changed to failed, -- cgit v1.2.3