# Asterisk Project : Test Hierarchy

Added by mjordan , edited by mjordan on Jun 23, 2012

Tests are discovered by the runtests.py script during run time of the Asterisk Test Suite. When it starts, the runtests script parses a YAML file, tests/tests.yaml, to determine what tests are in the Test Suite. The tests.yaml file can either specify a directory to search in for more tests, or a specific test directory to add to the list of available tests. If a search directory is specified, the runtests script looks for another tests.yaml file in that directory, and parses it to look for more tests. This recursive process continues until no more tests.yaml files are found.

Test directories specified in a tests.yaml file are processed in the following way:

1. If a test directory contains an executable run-test script, that script is opened as a separate process. This script can be written in any language. If the process returns a value of 0, the test passes; any other value is considered a test failure.
2. If no run-test script is in the test directory, an instance of TestRunner.py is spawned instead. The test directory is passed to TestRunner.py as the test to execute.

A tests.yaml file always contains the the keyword tests, which contains a sequence of directories to search for more tests in and test directories to execute.

## Specification

Keyword | Value | Required
--- | --- | ---
tests | A sequence of 'test' or 'dir' key/value pairs | Yes

### tests

Keyword | Value | Required
--- | --- | ---
test | Specifies a test directory to execute | No
dir | Specifies a directory to search for more tests | No

## Example

    tests:
        - test: 'example'
        - test: 'dynamic-modules'
        - dir: 'manager'
        - test: 'rfc2833_dtmf_detect'
        - dir: 'iax2'
        - dir: 'cdr'