diff --git a/lib/common_test/doc/src/config_file_chapter.xml b/lib/common_test/doc/src/config_file_chapter.xml
index 2d47b143c855..2ab9259dfbff 100644
--- a/lib/common_test/doc/src/config_file_chapter.xml
+++ b/lib/common_test/doc/src/config_file_chapter.xml
@@ -332,7 +332,7 @@
ftptest(Config) ->
Remote = filename:join(ct:get_config(lm_directory), "loadmodX"),
- Local = filename:join(?config(priv_dir,Config), "loadmodule"),
+ Local = filename:join(proplists:get_value(priv_dir,Config), "loadmodule"),
ok = ct_ftp:recv(ftp, Remote, Local),
...
@@ -347,7 +347,7 @@
end_per_testcase(ftptest, Config) ->
lists:foreach(fun(Handle) -> ct_ftp:close(Handle) end,
- ?config(ftp_handles,Config)).
+ proplists:get_value(ftp_handles,Config)).
ftptest() ->
[{require,ftp_host},
@@ -355,8 +355,8 @@
ftptest(Config) ->
Remote = filename:join(ct:get_config(lm_directory), "loadmodX"),
- Local = filename:join(?config(priv_dir,Config), "loadmodule"),
- [Handle | MoreHandles] = ?config(ftp_handles,Config),
+ Local = filename:join(proplists:get_value(priv_dir,Config), "loadmodule"),
+ [Handle | MoreHandles] = proplists:get_value(ftp_handles,Config),
ok = ct_ftp:recv(Handle, Remote, Local),
...
diff --git a/lib/common_test/doc/src/ct.xml b/lib/common_test/doc/src/ct.xml
index 0d7095db5d2a..613ecbd05b14 100644
--- a/lib/common_test/doc/src/ct.xml
+++ b/lib/common_test/doc/src/ct.xml
@@ -43,13 +43,10 @@
tests and basic functions for Common Test case issues, such as
configuration and logging.
- The framework stores configuration values in a property list usually named
+ Config. The list contains information about the test run added by the
+ framework itself and may also contain user-provided values. The configuration
+ is passed into individual test cases as well as support functions if defined.
diff --git a/lib/common_test/doc/src/ct_suite.xml b/lib/common_test/doc/src/ct_suite.xml
index 8e5a73143e3e..bb7e6b51f97b 100644
--- a/lib/common_test/doc/src/ct_suite.xml
+++ b/lib/common_test/doc/src/ct_suite.xml
@@ -593,8 +593,7 @@
(which also causes the test case process to terminate).
Elements from the Config list can, for example, be read
- with proplists:get_value/2 in STDLIB
- (or the macro ?config defined in ct.hrl).
+ with proplists:get_value/2 in STDLIB.
If you decide not to run the test case after all, return
{skip, Reason}. Reason is then
diff --git a/lib/common_test/doc/src/dependencies_chapter.xml b/lib/common_test/doc/src/dependencies_chapter.xml
index f5d409686eca..7458533984e6 100644
--- a/lib/common_test/doc/src/dependencies_chapter.xml
+++ b/lib/common_test/doc/src/dependencies_chapter.xml
@@ -118,8 +118,8 @@
end_per_testcase(start_and_stop, _) ->
ok;
- end_per_testcase(_, _) ->
- ServerPid = ?config(server_pid),
+ end_per_testcase(_, Config) ->
+ ServerPid = proplists:get_value(server_pid, Config),
stop_server(ServerPid).
%%% test cases...
@@ -133,12 +133,12 @@
%% configuration test
config(Config) ->
- ServerPid = ?config(server_pid, Config),
+ ServerPid = proplists:get_value(server_pid, Config),
configure_server(ServerPid).
%% test connecting and disconnecting client
connect_and_disconnect(Config) ->
- ServerPid = ?config(server_pid, Config),
+ ServerPid = proplists:get_value(server_pid, Config),
{ok,SessionId} = my_server:connect(ServerPid),
ok = my_server:disconnect(ServerPid, SessionId).
@@ -179,18 +179,18 @@
To save Config data, return tuple {save_config,ConfigList}
from end_per_testcase or from the main test case function.
- To read data saved by a previous test case, use macro config with a
- saved_config key as follows:
+ To read data saved by a previous test case, use proplists:get_value
+ with a saved_config key as follows:
- {Saver,ConfigList} = ?config(saved_config, Config)
+ {Saver,ConfigList} = proplists:get_value(saved_config, Config)
Saver (atom()) is the name of the previous test case (where the
- data was saved). The config macro can be used to extract particular data
- also from the recalled ConfigList. It is strongly recommended that
- Saver is always matched to the expected name of the saving test case.
- This way, problems because of restructuring of the test suite can be avoided.
- Also, it makes the dependency more explicit and the test suite easier to read
- and maintain.
+ data was saved). The proplists:get_value function can be used to extract
+ particular data also from the recalled ConfigList. It is strongly
+ recommended that Saver is always matched to the expected name of
+ the saving test case. This way, problems because of restructuring of the
+ test suite can be avoided. Also, it makes the dependency more explicit
+ and the test suite easier to read and maintain.
To pass data from one test suite to another, the same mechanism is used. The data
is to be saved by finction
@@ -211,9 +211,9 @@
init_per_suite(Config) ->
%% read config saved by previous test suite
- {server_a_SUITE,OldConfig} = ?config(saved_config, Config),
+ {server_a_SUITE,OldConfig} = proplists:get_value(saved_config, Config),
%% extract server identity (comes from server_a_SUITE)
- ServerId = ?config(server_id, OldConfig),
+ ServerId = proplists:get_value(server_id, OldConfig),
SessionId = connect_to_server(ServerId),
[{ids,{ServerId,SessionId}} | Config].
@@ -226,16 +226,16 @@
all() -> [allocate, deallocate].
allocate(Config) ->
- {ServerId,SessionId} = ?config(ids, Config),
+ {ServerId,SessionId} = proplists:get_value(ids, Config),
{ok,Handle} = allocate_resource(ServerId, SessionId),
%% save handle for deallocation test
NewConfig = [{handle,Handle}],
{save_config,NewConfig}.
deallocate(Config) ->
- {ServerId,SessionId} = ?config(ids, Config),
- {allocate,OldConfig} = ?config(saved_config, Config),
- Handle = ?config(handle, OldConfig),
+ {ServerId,SessionId} = proplists:get_value(ids, Config),
+ {allocate,OldConfig} = proplists:get_value(saved_config, Config),
+ Handle = proplists:get_value(handle, OldConfig),
ok = deallocate_resource(ServerId, SessionId, Handle).
To save Config data from a test case that is to be
@@ -245,7 +245,7 @@
The result is that the test case is skipped with Reason printed to
the log file (as described earlier) and ConfigList is saved
for the next test case. ConfigList can be read using
- ?config(saved_config, Config), as described earlier. skip_and_save
+ proplists:get_value(saved_config, Config), as described earlier. skip_and_save
can also be returned from init_per_suite. In this case, the saved data can
be read by init_per_suite in the suite that follows.
diff --git a/lib/common_test/doc/src/example_chapter.xml b/lib/common_test/doc/src/example_chapter.xml
index b82d14d2d8e0..e355e6ae7ce7 100644
--- a/lib/common_test/doc/src/example_chapter.xml
+++ b/lib/common_test/doc/src/example_chapter.xml
@@ -90,7 +90,7 @@
%% Description: Cleanup after the suite.
%%--------------------------------------------------------------------
end_per_suite(Config) ->
- Ref = ?config(con_ref, Config),
+ Ref = proplists:get_value(con_ref, Config),
db:disconnect(Ref),
ok.
@@ -105,8 +105,8 @@
%% Description: Initialization before each test case.
%%--------------------------------------------------------------------
init_per_testcase(Case, Config) ->
- Ref = ?config(con_ref, Config),
- TableName = ?config(table_name, Config),
+ Ref = proplists:get_value(con_ref, Config),
+ TableName = proplists:get_value(table_name, Config),
ok = db:create_table(Ref, TableName, table_type(Case)),
Config.
@@ -121,8 +121,8 @@
%% Description: Cleanup after each test case.
%%--------------------------------------------------------------------
end_per_testcase(_Case, Config) ->
- Ref = ?config(con_ref, Config),
- TableName = ?config(table_name, Config),
+ Ref = proplists:get_value(con_ref, Config),
+ TableName = proplists:get_value(table_name, Config),
ok = db:delete_table(Ref, TableName),
ok.
@@ -154,8 +154,8 @@
insert_and_lookup(Key, Value, Config) ->
- Ref = ?config(con_ref, Config),
- TableName = ?config(table_name, Config),
+ Ref = proplists:get_value(con_ref, Config),
+ TableName = proplists:get_value(table_name, Config),
ok = db:insert(Ref, TableName, Key, Value),
[Value] = db:lookup(Ref, TableName, Key),
ok = db:delete(Ref, TableName, Key),
diff --git a/lib/common_test/doc/src/write_test_chapter.xml b/lib/common_test/doc/src/write_test_chapter.xml
index 248ef317b9ae..d945e0a58f58 100644
--- a/lib/common_test/doc/src/write_test_chapter.xml
+++ b/lib/common_test/doc/src/write_test_chapter.xml
@@ -277,10 +277,9 @@
proplists:get_value/2.
Also, or alternatively, the general lists
module contains useful functions. Normally, the only operations
- performed on Config is insert (adding a tuple to the head of the list)
- and lookup. Common Test provides a simple macro named ?config,
- which returns a value of an item in Config given the key (exactly like
- proplists:get_value). Example: PrivDir = ?config(priv_dir, Config).
+ performed on Config are insertion (adding a tuple to the head of the list)
+ and lookup. To look up a value in the config, proplists:get_value can
+ be used. For example: PrivDir = proplists:get_value(priv_dir, Config).
If the test case function crashes or exits purposely, it is considered
@@ -717,7 +716,7 @@
The following is an example of how to return the status from a group:
end_per_group(_Group, Config) ->
- Status = ?config(tc_group_result, Config),
+ Status = proplists:get_value(tc_group_result, Config),
case proplists:get_value(failed, Status) of
[] -> % no failed cases
{return_group_result,ok};
@@ -733,7 +732,7 @@
Example:
end_per_group(group1, Config) ->
- Status = ?config(tc_group_result, Config),
+ Status = proplists:get_value(tc_group_result, Config),
Failed = proplists:get_value(failed, Status),
case lists:member({group_result,group2}, Failed) of
true ->