## 7 Config Files

### 7.1 General

The Common Test framework uses configuration files to describe data related to a test or a test plant. The configuration data makes it possible to change properties without changing the test program itself. Configuration data can for example be:

- Addresses to the test plant or other instruments
- Filenames for files needed by the test
- Program names for programs that shall be run by the test
- Any other variable that is needed by the test

### 7.2 Syntax

A config file can contain any number of elements of the type:

          {Key,Value}.

where

          Key = atom()
          Value = term() | [{Key,Value}]

### 7.3 Reading config values

From inside a test suite, one can require a variable to exist before a test case can be run, and read the value of a variable.

require is a statement that can be part of the test suite default data or test case info function. If the required variable is not available, the test is skipped. There is also a function ct:require/[1,2] which can be called from inside a test suite in order to check if a specific variable is available. The return value from the function must then be checked and appropriate actions taken explicitly by the test case.

A require statement should look like this: {require,Required} or {require,Name,Required}. The arguments Name and Required are the same as the arguments to ct:require/[1,2] which are described in the reference manual for ct.

To read the value of a config variable, use the function get_config/[1,2] which is also described in the reference manual for ct.

### 7.4 Examples

A config file for usning telnet to communicate with a unix host could look like this:

        {unix,[{telnet,"durin.du.uab"},
               {username,"someuser"},
               {password,"somepassword"}]}.

common_test 1.3.3
Copyright © 1991-2008 Ericsson AB