ct

MODULE

MODULE SUMMARY

DESCRIPTION

This module implements the command line interface for running
tests and some basic functions for common test case issues
such as configuration and logging.

Test Suite Support Macros

The config macro is defined in ct.hrl. This
macro should be used to retrieve information from the
Config variable sent to all test cases. It is used with two
arguments, where the first is the name of the configuration
variable you wish to retrieve, and the second is the Config
variable supplied to the test case.

Possible configuration variables include:

data_dir - Data file directory.

priv_dir - Scratch file directory.

Whatever added by init_per_suite/1 or
init_per_testcase/2 in the test suite.

DATA TYPES

handle() = handle() (see module ct_gen_conn) | term()

The identity of a
specific connection.

target_name() = var_name()

The name of a target.

var_name() = atom()

A variable name which is specified when
ct:require/2 is called,
e.g. ct:require(mynodename,{node,[telnet]})

EXPORTS

When calling this function, the currently executing test case will be aborted.
It is the user's responsibility to know for sure which test case is currently
executing. The function is therefore only safe to call from a function which
has been called (or synchronously invoked) by the test case.

Reason, the reason for aborting the test case, is printed
in the test case log.

This function decrypts EncryptFileName, previously
generated with encrypt_config_file/2/3. The original
file contents is saved in the target file. The encryption key, a
string, must be available in a text file named
.ct_config.crypt in the current directory, or the
home directory of the user (it is searched for in that order).

This function decrypts EncryptFileName, previously
generated with encrypt_config_file/2/3. The original
file contents is saved in the target file. The key must have the
the same value as that used for encryption.

This function encrypts the source config file with DES3 and
saves the result in file EncryptFileName. The key,
a string, must be available in a text file named
.ct_config.crypt in the current directory, or the
home directory of the user (it is searched for in that order).

See the Common Test User's Guide for information about using
encrypted config files when running tests.

This function encrypts the source config file with DES3 and
saves the result in the target file EncryptFileName.
The encryption key to use is either the value in
{key,Key} or the value stored in the file specified
by {file,File}.

See the Common Test User's Guide for information about using
encrypted config files when running tests.

If a config variable is defined in multiple files and you want to
access all possible values, use the all option. The
values will be returned in a list and the order of the elements
corresponds to the order that the config files were specified at
startup.

If you want config elements (key-value tuples) returned as result
instead of values, use the element option.
The returned elements will then be on the form {KeyOrName,Value},
or (in case a subkey has been specified)
{{KeyOrName,SubKey},Value}

If the requested data is available, the main entry will be
associated with Name so that the value of the element
can be read with get_config/1,2 provided
Name instead of the Key.

Example: Require one node with a telnet connection and an
ftp connection. Name the node a:ok =
ct:require(a,{node,[telnet,ftp]}).
All references
to this node may then use the node name. E.g. you can fetch a
file over ftp like this:ok = ct:ftp_get(a,RemoteFile,LocalFile).

Run tests as specified by the combination of options in Opts.
The options are the same as those used with the run_test script.
Note that here a TestDir can be used to point out the path to
a Suite. Note also that the option testcase
corresponds to the -case option in the run_test
script. Configuration files specified in Opts will be
installed automatically at startup.

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 unix command line with run_test -shell
[-config File...].

If any functions using "required config data" (e.g. telnet or
ftp functions) are to be called from the erlang shell, config data
must first be required with ct:require/2.