User's Guide
Reference Manual
Release Notes
PDF
Top

Common Test
User's Guide
Version 1.4.6

Expand All
Contract All

Chapters

- Common Test Basics
  - Top of chapter
  - Introduction
  - Test Suite Organisation
  - Support Libraries
  - Suites and Test Cases
  - External Interfaces
- Installation
  - Top of chapter
  - General information
  - Unix/Linux
  - Windows
- Writing Test Suites
  - Top of chapter
  - Support for test suite authors
  - Test suites
  - Init and end per suite
  - Init and end per test case
  - Test cases
  - Test case info function
  - Test suite info function
  - Test case groups
  - The parallel property and nested groups
  - Repeated groups
  - Shuffled test case order
  - Data and Private Directories
  - Execution environment
  - Illegal dependencies
- Test Structure
  - Top of chapter
  - Test structure
  - Skipping test cases
  - Definition of terms
- Examples and Templates
  - Top of chapter
  - Test suite example
  - Test suite templates
- Running Test Suites
  - Top of chapter
  - Using the Common Test Framework
  - Automatic compilation of test suites and help modules
  - Running tests from the UNIX command line
  - Running tests from the Web based GUI
  - Running tests from the Erlang shell or from an Erlang program
  - Running the interactive shell mode
  - Step by step execution of test cases with the Erlang Debugger
  - Using test specifications
  - Log files
  - HTML Style Sheets
  - Repeating tests
  - Silent Connections
- Config Files
  - Top of chapter
  - General
  - Syntax
  - Requiring and reading configuration data
  - Using configuration variables defined in multiple files
  - Encrypted configuration files
  - Opening connections by using configuration data
  - Examples
- Code Coverage Analysis
  - Top of chapter
  - General
  - Usage
  - The cover specification file
  - Logging
- Using Common Test for Large Scale Testing
  - Top of chapter
  - General
  - Usage
  - Test Specifications
- Event Handling
  - Top of chapter
  - General
  - Usage
- Dependencies between Test Cases and Suites
  - Top of chapter
  - General
  - Saving configuration data
  - Sequences
- Some thoughts about testing
  - Top of chapter
  - Goals
  - What to test?

# 2 Installation

### 2.1 General information

The two main interfaces for running tests with Common Test are an executable Bourne shell script named run_test and an erlang module named ct. The shell script will work on Unix/Linux (and Linux-like environments such as Cygwin on Windows) and the ct interface functions can be called from the Erlang shell (or from any Erlang function) on any supported platform.

The Common Test application is installed with the Erlang/OTP system and no explicit installation is required to start using Common Test by means of the interface functions in the ct module. If you wish to use run_test, however, this script needs to be generated first, according to the instructions below.

### 2.2 Unix/Linux

Go to the common_test-<vsn> directory, located among the other OTP applications (under the OTP lib directory). Here you execute the install.sh script with argument local:

$ ./install.sh local

This generates the executable run_test script in the common_test-<vsn>/priv/bin directory. The script will include absolute paths to the Common Test and Test Server application directories, so it's possible to copy or move the script to a different location on the file system, if desired, without having to update it. It's of course possible to leave the script under the priv/bin directory and update the PATH variable accordingly (or create a link or alias to it).

If you, for any reason, have copied Common Test and Test Server to a different location than the default OTP lib directory, you can generate a run_test script with a different top level directory, simply by specifying the directory, instead of local, when running install.sh. Example:

$ install.sh /usr/local/test_tools

Note that the common_test-<vsn> and test_server-<vsn> directories must be located under the same top directory. Note also that the install script does not copy files or update environment variables. It only generates the run_test script.

Whenever you install a new version of Erlang/OTP, the run_test script needs to be regenerated, or updated manually with new directory names (new version numbers), for it to "see" the latest Common Test and Test Server versions.

For more information on the run_test script and the ct module, please see the reference manual.

### 2.3 Windows

On Windows it is very convenient to use Cygwin (www.cygwin.com) for running Common Test and Erlang, since it enables you to use the run_test script for starting Common Test. If you are a Cygwin user, simply follow the instructions above for generating the run_test script.

If you do not use Cygwin, you have to rely on the API functions in the ct module (instead of run_test) for running Common Test as described initially in this chapter.

If you, for any reason, have chosen to store Common Test and Test Server in a different location than the default OTP lib directory, make sure the ebin directories of these applications are included in the Erlang code server path (so the application modules can be loaded).