Main user interface for the
This module implements the command-line interface for running
tests and basic functions for
Test Suite Support Macros
The
Possible configuration variables include:
Whatever added by
The identity (handle) of a connection.
A name and association to configuration data introduced
through a require statement, or a call to
Aborts the currently executing test case. The user must know with certainty which test case is currently executing. The function is therefore only safe to call from a function that has been called (or synchronously invoked) by the test case.
Loads configuration variables using the specified callback module and
configuration string. The callback module is to be either loaded or
present in the code part. Loaded configuration variables can later
be removed using function
Cancels any active timetrap and pauses the execution of the
current test case until the user calls function
A cancelled timetrap is not automatically reactivated after the
break, but must be started exlicitly with
In order for the break/continue functionality to work,
Works the same way as
For details, see
Equivalent to
Returns and purges the list of text strings buffered during the
latest session of capturing printouts to
See also
Starts capturing all text strings printed to
See also
Stops capturing text strings (a session started with
See also
Prints the specified
If called several times, only the last comment is printed. The
test case return value
Prints the formatted string in the comment field in the table on the test suite result page.
Arguments
This function must be called to continue after a test case
(not executing in a parallel group) has called function
This function must be called to continue after a test case has
called
Decrypts
Decrypts
Encrypts the source configuration file with DES3 and saves the result
in file
For information about using encrypted configuration files when
running tests, see section
For details on DES3 encryption/decryption, see application
Encrypts the source configuration file with DES3 and saves the result
in the target file
For information about using encrypted configuration files when
running tests, see section
For details on DES3 encryption/decryption, see application
Terminates a test case with the specified error
Terminates a test case with an error message specified by a
format string and a list of values (used as arguments to
Equivalent to
Equivalent to
Reads configuration data values.
Returns the matching values or configuration elements, given a
configuration variable key or its associated name (if one has been
specified with
Example:
Given the following configuration file:
{unix,[{telnet,IpAddr}, {user,[{username,Username}, {password,Password}]}]}.
Then:
ct:get_config(unix,Default) -> [{telnet,IpAddr}, {user, [{username,Username}, {password,Password}]}] ct:get_config({unix,telnet},Default) -> IpAddr ct:get_config({unix,user,username},Default) -> Username ct:get_config({unix,ftp},Default) -> Default ct:get_config(unknownkey,Default) -> Default
If a configuration variable key has been associated with a name (by
ct:require(myuser,{unix,user}) -> ok. ct:get_config(myuser,Default) -> [{username,Username}, {password,Password}]
If a configuration variable is defined in multiple files, use option
If configuration elements (key-value tuples) are to be returned as
result instead of values, use option
See also
Gets a reference to the
Example:
gen_event:add_handler(ct:get_event_mgr_ref(), my_ev_h, [])
Returns status of ongoing test. The returned list contains information about which test case is executing (a list of cases when a parallel test case group is executing), as well as counters for successful, failed, skipped, and total test cases so far.
Returns the name of the target that the specified connection belongs to.
Gets a list of all test specification terms used to configure and run this test.
Reads one or more terms from the test specification used to
configure and run this test.
All value tuples returned, except user terms, have the node name as first element.
To read test terms, use
Reads information about the timetrap set for the current test
case.
Installs configuration files and event handlers.
Run this function once before the first test.
Example:
install([{config,["config_node.ctc","config_user.ctc"]}])
This function is automatically run by program
Performs command
Equivalent to
Equivalent to
Equivalent to
Equivalent to
Prints from a test case to the log file.
This function is meant for printing a string directly from a test case to the test case log file.
Default
For details on
Common Test will not escape special HTML characters (<, > and &)
in the text printed with this function, unless the
If the test is started with option
Sends an asynchronous notification of type
See also
Equivalent to
Equivalent to
Equivalent to
Prints and logs from a test case.
This function is meant for printing a string from a test case, both to the test case log file and to the console.
Default
For details on
Note that special characters in the text (<, > and &) will be escaped by Common Test before the text is printed to the log file.
Parses the printout from an SQL table and returns a list of tuples.
The printout to parse is typically the result of a
Equivalent to
Equivalent to
Equivalent to
Prints from a test case to the console.
This function is meant for printing a string from a test case to the console.
Default
For details on
Reloads configuration file containing specified configuration key.
This function updates the configuration data from which the specified configuration variable was read, and returns the (possibly) new value of this variable.
If some variables were present in the configuration, but are not loaded using this function, they are removed from the configuration table together with their aliases.
Removes configuration variables (together wih their aliases) that were loaded with specified callback module and configuration string.
Checks if the required configuration is available. Arbitrarily
deep tuples can be specified as
Example 1. Require the variable
ok = ct:require(myvar).
In this case the configuration file must at least contain:
{myvar,Value}.
Example 2. Require key
ok = ct:require({myvar,[sub1,sub2]}).
In this case the configuration file must at least contain:
{myvar,[{sub1,Value},{sub2,Value}]}.
Example 3. Require key
ok = ct:require({myvar,sub1,sub2}).
In this case the configuration file must at least contain:
{myvar,[{sub1,[{sub2,Value}]}]}.
See also
Checks if the required configuration is available and gives it a
name. The semantics for
If the requested data is available, the subentry is associated
with
Example:
Require one node with a Telnet connection and an FTP connection.
Name the node
ok = ct:require(a,{machine,node}).
All references to this node can then use the node name. For example, a file over FTP is fetched like follows:
ok = ct:ftp_get(a,RemoteFile,LocalFile).
For this to work, the configuration file must at least contain:
{machine,[{node,[{telnet,IpAddr},{ftp,IpAddr}]}]}.
The behavior of this function changed radically in
This associates the name
See also
Runs all test cases in all suites in the specified directories.
See also
Runs all test cases in the specified suite.
See also
Runs the specified test cases.
Requires that
Suites (
Runs tests as specified by the combination of options in
Here a
Runs a test specified by
This function, similar to
Starts
From this mode, all test case support functions can be executed
directly from the Erlang shell. The interactive mode can also be
started from the OS command line with
If any functions (for example, Telnet or FTP) using
"required configuration data" are to be called from the Erlang shell,
configuration data must first be required with
Example:
> ct:require(unix_telnet, unix). ok > ct_telnet:open(unix_telnet). {ok,<0.105.0>} > ct_telnet:cmd(unix_telnet, "ls ."). {ok,["ls","file1 ...",...]}
Steps through a test case with the debugger.
See also
Steps through a test case with the debugger. If option
See also
Exits the interactive mode.
See also
Sends a synchronous notification of type
See also
Returns all test cases in the specified suite.
Sets a new timetrap for the running test case.
If the argument is
Returns any data specified with tag
Returns any data specified with tag