# Asterisk Project : runtests Configuration

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

The runtests script has its own test-config.yaml configuration file. This configuration file specifies global settings for the execution of the Asterisk Test Suite.

Many of the settings in the runtests script's test-config.yaml are for advanced execution of the Test Suite. Often changing these values from the default will not be necessary.

## Specification

Keyword | Value | Required
--- | --- | ---
global-settings | Defines settings that are applicable to all test configurations | Yes
Configuration Name | A test configuration that can be executed | One or More

### global-settings

Keyword | Value | Required
--- | --- | ---
test-configuration | Defines the test configuration to execute. The value of this keyword must match a key defined at the same hierarchical level as the global-settings keyword | Yes
condition-definitions | A sequence. Defines the available Python modules for the Pre/Post Condition checking framework. | No

#### condition-definitions

Keyword | Value | Required
--- | --- | ---
name | The alias name that a test uses to refer to this condition check pair | Yes
pre | The configuration information for the pre-test condition check object | Yes
post | The configuration information for the post-test condition check object | Yes

##### pre

Keyword | Value | Required
--- | --- | ---
typename | The fully qualified name of the package.module.class to instantiate as a pre-condition | Yes

The python module search path is always appended with "lib/python"

##### post

Keyword | Value | Required
--- | --- | ---
typename | The fully qualified name of the package.module.class to instantiate as a post-condition | Yes
related-type | The fully qualified name of the package.module.class that specifies a pre-condition to inject into the instantiated post-condition object | No

The python module search path is always appended with "lib/python"

### test-configuration

A test-configuration entry can have any unique key name. The value of global-settings/test-configuration must reference one of these unique key names.

Keyword | Value | Required
--- | --- | ---
exclude-tests | A sequence of test names to exclude from execution | No
properties | Global properties that will be applied to all tests in the Test Suite | No

#### properties

Keyword | Value | Required
--- | --- | ---
testconditions | A sequence of key/value pairs, specifying the alias of a Pre/Post condition object to create for each test | No

##### testconditions

Keyword | Value | Required
--- | --- | ---
name | The alias name of a Pre/Post condition pair to create for each test | One or more

## Examples

### Specifying a Subset of Tests to Execute

    # Global settings
    global-settings:
        # The active test configuration.  The value must match a subsequent key
        # in this file, which defines the global settings to apply to the test execution
        # run.
        test-configuration: config-fast

    # Exclude all long-running tests (greater than one minute)
    config-fast:
        exclude-tests:
            - 'authenticate_invalid_password'
            - 'check_voicemail_callback'
            - 'check_voicemail_delete'
            - 'check_voicemail_dialout'
            - 'check_voicemail_envelope'
            - 'check_voicemail_new_user'
            - 'check_voicemail_nominal'
            - 'check_voicemail_reply'
            - 'leave_voicemail_external_notification'
            - 'leave_voicemail_nominal'
            - 'gateway_g711_t38'
            - 'gateway_mix1'
            - 'gateway_mix2'
            - 'gateway_mix3'
            - 'gateway_mix4'
            - 'gateway_native_t38'
            - 'gateway_native_t38_ced'
            - 'gateway_no_t38'
            - 'gateway_t38_g711'
            - 'gateway_timeout1'
            - 'gateway_timeout2'
            - 'gateway_timeout3'
            - 'gateway_timeout4'
            - 'gateway_timeout5'

    # Include all tests that can run under the installed version of Asterisk.
    # It is included merely for completeness.
    config-standard:

### Specifying Pre- and Post-Conditions

    # Global settings
    global-settings:
        # The active test configuration.  The value must match a subsequent key
        # in this file, which defines the global settings to apply to the test execution
        # run.
        test-configuration: config-thread-checking

        # The following sequence defines for any test configuration the available pre-
        # and post-test conditions.  The 'name' field specifies how the test configurations
        # refer to the pre- and post-test conditions in order to activate them.
        condition-definitions:
                -
                    name: 'threads'
                    pre:
                        typename: 'asterisk.ThreadTestCondition.ThreadPreTestCondition'
                    post:
                        typename: 'asterisk.ThreadTestCondition.ThreadPostTestCondition'
                        related-type: 'asterisk.ThreadTestCondition.ThreadPreTestCondition'

    # This test enables the pre- and post-test condition for threads on all tests
    # that support it.  Individual tests can override the behavior of a pre-
    # and post-test condition check in their test-config.yaml files.
    config-thread-checking:
        properties:
            testconditions:
                - name: 'threads'