<html>
<head>
    <base href="https://wiki.asterisk.org/wiki">
            <link rel="stylesheet" href="/wiki/s/en/2172/18/9/_/styles/combined.css?spaceKey=AST&amp;forWysiwyg=true" type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://wiki.asterisk.org/wiki/display/AST/Test+Configuration">Test Configuration</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://wiki.asterisk.org/wiki/display/~mjordan">Matt Jordan</a>
    </h4>
        <br/>
                         <h4>Changes (2)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >h2. Examples <br> <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">h3. Simple Test <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">h3. channels/SIP/info_dtmf <br> <br>{code} <br>testinfo: <br>    summary: &#39;Test that asterisk properly handles DTMF relayed in SIP INFO requests&#39; <br>    description: | <br>        This test checks proper handling of SIP INFO requests containing DTMF events. <br>        This includes both application/dtmf-relay and application/dtmf content types, <br>        and checks for DTMF values 0-9, A-D, a-d, *, #, !, and blank message bodies. <br> <br>properties: <br>    minversion: &#39;1.8.0.0&#39; <br>    dependencies: <br>        - python : &#39;twisted&#39; <br>        - python : &#39;starpy&#39; <br>        - sipp : <br>            version : &#39;v3.0&#39; <br>    tags: <br>        - SIP <br>        - DTMF <br>{code} <br> <br>h3. fax/gateway_mix4 <br> <br>{code} <br>testinfo: <br>    summary: &#39;Test the fax gateway.&#39; <br>    description: | <br>        This test verifies proper gateway functionality when a pass through <br>        t38 negotiation request fails. The sending side will reject the passed <br>        through negotiation request. The gateway should detect this respond to <br>        the receiving side as if no failure had occured and then gateway the <br>        fax. <br> <br>        The call flow looks like this: <br>         |send        | <br>         |g711     t38| <br>         |-----------&gt;| <br>         |     gateway| <br>         |t38      t38| <br>         |&lt;-----------| <br>        \|receive     |/ <br> <br>properties: <br>    minversion: &#39;10.0.0&#39; <br>    dependencies: <br>        - python : &#39;twisted&#39; <br>        - python : &#39;starpy&#39; <br>        - custom : &#39;fax&#39; <br>    tags: <br>        - fax <br>        - fax_gateway <br>{code} <br> <br>h3. cdr/cdr_userfield <br> <br>{code} <br>testinfo: <br>    summary: &#39;Test that Set(CDR(userfield)=...) works&#39; <br>    description: | <br>        &#39;Test that setting the userfield field in the CDR works&#39; <br> <br>test-modules: <br>    test-object: <br>        config-section: test-object-config <br>        typename: &#39;SimpleTestCase.SimpleTestCase&#39; <br>    modules: <br>        - <br>            config-section: &#39;cdr-config&#39; <br>            typename: &#39;cdr.CDRModule&#39; <br> <br>test-object-config: <br>    spawn-after-hangup: True <br>    test-iterations: <br>        - <br>            channel: &#39;Local/1@default&#39; <br>            application: &#39;Echo&#39; <br> <br>cdr-config: <br>    - <br>        file: &#39;cdrtest_local&#39; <br>        lines: <br>            - <br>                source: &#39;&#39; <br>                destination: &#39;1&#39; <br>                dcontext: &#39;default&#39; <br>                callerid: &#39;&#39; <br>                channel: &#39;Local/1@default-.*&#39; <br>                dchannel: &#39;&#39; <br>                lastapp: &#39;Hangup&#39; <br>                lastarg: &#39;&#39; <br>                disposition: &#39;ANSWERED&#39; <br>                amaflags: &#39;DOCUMENTATION&#39; <br>                userfield: &#39;bazinga&#39; <br> <br>properties: <br>    minversion: &#39;1.8.0.0&#39; <br>    dependencies: <br>        - python : &#39;twisted&#39; <br>        - python : &#39;starpy&#39; <br>        - asterisk : &#39;cdr_csv&#39; <br>    tags: <br>        - CDR <br>        - chan_local <br>{code} <br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <p>Every test has a <em>test-config.yaml</em> file that serves four purposes:</p>
<ul>
        <li>It describes and documents the test</li>
        <li>It determines what necessary attributes an installation of Asterisk must have in order to run the test</li>
        <li>It determines what software must exist on a test system to run the test</li>
        <li>It configures attributes of the test</li>
</ul>


<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/wiki/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>Some modules are configured via a test's <em>test-config.yaml</em> file.  As those modules determine their own configuration, those configuration options are documented elsewhere.</td></tr></table></div>

<h2><a name="TestConfiguration-Specification"></a>Specification</h2>

<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'>Keyword</th>
<th class='confluenceTh'>Description</th>
<th class='confluenceTh'>Required</th>
</tr>
<tr>
<td class='confluenceTd'> test-info </td>
<td class='confluenceTd'> Section that describes basic information about the test </td>
<td class='confluenceTd'> Yes </td>
</tr>
<tr>
<td class='confluenceTd'> properties </td>
<td class='confluenceTd'> Contains properties that define how the test executes </td>
<td class='confluenceTd'> Yes </td>
</tr>
<tr>
<td class='confluenceTd'> test-modules </td>
<td class='confluenceTd'> Modules to load for tests that use the Test Suite's pluggable framework </td>
<td class='confluenceTd'> No </td>
</tr>
</tbody></table>
</div>


<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/wiki/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>If using the Test Suite's pluggable framework, the test-modules block is required.</td></tr></table></div>

<h3><a name="TestConfiguration-testinfo"></a>test-info </h3>

<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'>Keyword</th>
<th class='confluenceTh'>Description</th>
<th class='confluenceTh'>Required</th>
</tr>
<tr>
<td class='confluenceTd'>summary</td>
<td class='confluenceTd'>A summary of what the test does</td>
<td class='confluenceTd'> Yes </td>
</tr>
<tr>
<td class='confluenceTd'>description</td>
<td class='confluenceTd'>A detailed description of what functionality is covered by the test </td>
<td class='confluenceTd'> Yes </td>
</tr>
<tr>
<td class='confluenceTd'>skip</td>
<td class='confluenceTd'>If true, skip execution of this test</td>
<td class='confluenceTd'>No</td>
</tr>
<tr>
<td class='confluenceTd'>issues</td>
<td class='confluenceTd'>A sequence of key/value pairs specifying issues in an issue tracker related to this test</td>
<td class='confluenceTd'>No</td>
</tr>
</tbody></table>
</div>


<h4><a name="TestConfiguration-issues"></a>issues</h4>

<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'>Keyword</th>
<th class='confluenceTh'>Description</th>
<th class='confluenceTh'>Required</th>
</tr>
<tr>
<td class='confluenceTd'>mantis</td>
<td class='confluenceTd'>A mantis issue identifier</td>
<td class='confluenceTd'>No</td>
</tr>
<tr>
<td class='confluenceTd'>jira</td>
<td class='confluenceTd'>A JIRA issue identifier</td>
<td class='confluenceTd'>No</td>
</tr>
</tbody></table>
</div>


<h3><a name="TestConfiguration-properties"></a>properties</h3>

<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'>Keyword</th>
<th class='confluenceTh'>Description</th>
<th class='confluenceTh'>Required</th>
</tr>
<tr>
<td class='confluenceTd'>minversion</td>
<td class='confluenceTd'>The minimum version of Asterisk necessary to run the test</td>
<td class='confluenceTd'>Yes</td>
</tr>
<tr>
<td class='confluenceTd'>maxversion</td>
<td class='confluenceTd'>The maximum version of Asterisk that this test can exeucte under</td>
<td class='confluenceTd'>No</td>
</tr>
<tr>
<td class='confluenceTd'>features</td>
<td class='confluenceTd'>A sequence of feature specifies that the version of Asterisk under test must support.</td>
<td class='confluenceTd'>No</td>
</tr>
<tr>
<td class='confluenceTd'>dependencies</td>
<td class='confluenceTd'>The Asterisk modules and third party applications/libraries necessary to run the test</td>
<td class='confluenceTd'>No</td>
</tr>
<tr>
<td class='confluenceTd'>expectedResult</td>
<td class='confluenceTd'>The expected result of the test.  Setting this to False will cause the test to pass if the test returns failure</td>
<td class='confluenceTd'>No</td>
</tr>
<tr>
<td class='confluenceTd'>testconditions</td>
<td class='confluenceTd'>Settings that override the <em>runtests</em> script's <em>test-config.yaml</em> pre/post condition test settings</td>
<td class='confluenceTd'>No</td>
</tr>
<tr>
<td class='confluenceTd'>tags</td>
<td class='confluenceTd'>A sequence of tags that categorize the test into groups of similar functionality</td>
<td class='confluenceTd'>No</td>
</tr>
</tbody></table>
</div>


<h4><a name="TestConfiguration-dependencies"></a>dependencies</h4>

<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/wiki/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>Any of the keywords listed below can occur multiple times</td></tr></table></div>

<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'>Keyword</th>
<th class='confluenceTh'>Description</th>
<th class='confluenceTh'>Required</th>
</tr>
<tr>
<td class='confluenceTd'>app</td>
<td class='confluenceTd'>An external application that must be present for the test to execute</td>
<td class='confluenceTd'>No</td>
</tr>
<tr>
<td class='confluenceTd'>asterisk</td>
<td class='confluenceTd'>An asterisk module that must be installed for the test to execute</td>
<td class='confluenceTd'>No</td>
</tr>
<tr>
<td class='confluenceTd'>buildoption</td>
<td class='confluenceTd'>An option that must be enabled in the Asterisk build for the test to execute</td>
<td class='confluenceTd'>No</td>
</tr>
<tr>
<td class='confluenceTd'>pcap</td>
<td class='confluenceTd'>If present, import the yappcap library as a dependency for test execution</td>
<td class='confluenceTd'>No</td>
</tr>
<tr>
<td class='confluenceTd'>python</td>
<td class='confluenceTd'>A python module that must be available.  Note that an attempt will be made to import the module (using _<em>import</em>_) specified by the value of this keyword</td>
<td class='confluenceTd'>No</td>
</tr>
<tr>
<td class='confluenceTd'>sipp</td>
<td class='confluenceTd'>Specifies attributes of SIPp that must be present for this test to execute</td>
<td class='confluenceTd'>No</td>
</tr>
<tr>
<td class='confluenceTd'>custom</td>
<td class='confluenceTd'>Execute a custom dependency function.  The function must be defined in the Dependency class in the TestConfig module, and must be declared as "depend_%s", where %s is the value specified by the custom keyword</td>
<td class='confluenceTd'>No</td>
</tr>
</tbody></table>
</div>


<h5><a name="TestConfiguration-sipp"></a>sipp</h5>

<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'>Keyword</th>
<th class='confluenceTh'>Description</th>
<th class='confluenceTh'>Required</th>
</tr>
<tr>
<td class='confluenceTd'>version</td>
<td class='confluenceTd'>The minimum version of SIPp needed to execute the test</td>
</tr>
<tr>
<td class='confluenceTd'>feature</td>
<td class='confluenceTd'>A feature that SIPp must be compiled with in order to execute the test</td>
</tr>
</tbody></table>
</div>


<h4><a name="TestConfiguration-testconditions"></a>testconditions</h4>

<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'>Keyword</th>
<th class='confluenceTh'>Description</th>
<th class='confluenceTh'>Required</th>
</tr>
<tr>
<td class='confluenceTd'>name</td>
<td class='confluenceTd'>The alias name for the pre/post condition test object whose settings should be overridden</td>
<td class='confluenceTd'>Yes</td>
</tr>
</tbody></table>
</div>


<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/wiki/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>Each pre/post test condition pair defines their own configuration, and are not documented here.</td></tr></table></div>

<h3><a name="TestConfiguration-testmodules"></a>test-modules</h3>

<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'>Keyword</th>
<th class='confluenceTh'>Description</th>
<th class='confluenceTh'>Required</th>
</tr>
<tr>
<td class='confluenceTd'>test-object</td>
<td class='confluenceTd'>Defines the primary object that orchestrates test execution</td>
<td class='confluenceTd'>Yes</td>
</tr>
<tr>
<td class='confluenceTd'>modules</td>
<td class='confluenceTd'>A sequence that defines optional pluggable modules to inject into the test object</td>
<td class='confluenceTd'>No</td>
</tr>
</tbody></table>
</div>


<h4><a name="TestConfiguration-testobject"></a>test-object</h4>

<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'>Keyword</th>
<th class='confluenceTh'>Description</th>
<th class='confluenceTh'>Required</th>
</tr>
<tr>
<td class='confluenceTd'>config-section</td>
<td class='confluenceTd'>The keyword in the <em>test-config.yaml</em> file that provides the configuration for the test object</td>
<td class='confluenceTd'>Yes</td>
</tr>
<tr>
<td class='confluenceTd'>typename</td>
<td class='confluenceTd'>The fully qualified package.module.class to instantiate as the test object</td>
<td class='confluenceTd'>Yes</td>
</tr>
</tbody></table>
</div>


<h4><a name="TestConfiguration-modules"></a>modules</h4>

<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'>Keyword</th>
<th class='confluenceTh'>Description</th>
<th class='confluenceTh'>Required</th>
</tr>
<tr>
<td class='confluenceTd'>config-section</td>
<td class='confluenceTd'>The keyword in the <em>test-config.yaml</em> file that provides the configuration for the module</td>
<td class='confluenceTd'>Yes</td>
</tr>
<tr>
<td class='confluenceTd'>typename</td>
<td class='confluenceTd'>The fully qualified package.module.class to instantiate as the module</td>
<td class='confluenceTd'>Yes</td>
</tr>
<tr>
<td class='confluenceTd'>load-from-path</td>
<td class='confluenceTd'>Optionally, specify the path where the pluggable module should be imported from</td>
<td class='confluenceTd'>No</td>
</tr>
<tr>
<td class='confluenceTd'>load-from-test</td>
<td class='confluenceTd'>Optionally, if true, load from the test directory</td>
<td class='confluenceTd'>No</td>
</tr>
</tbody></table>
</div>


<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/wiki/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>The options load-from-path and load-from-test are mutually exclusive.</td></tr></table></div>

<h2><a name="TestConfiguration-Examples"></a>Examples</h2>

<h3><a name="TestConfiguration-channels%2FSIP%2Finfodtmf"></a>channels/SIP/info_dtmf</h3>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">testinfo:
    summary: 'Test that asterisk properly handles DTMF relayed in SIP INFO requests'
    description: |
        This test checks proper handling of SIP INFO requests containing DTMF events.
        This includes both application/dtmf-relay and application/dtmf content types,
        and checks for DTMF values 0-9, A-D, a-d, *, #, !, and blank message bodies.

properties:
    minversion: '1.8.0.0'
    dependencies:
        - python : 'twisted'
        - python : 'starpy'
        - sipp :
            version : 'v3.0'
    tags:
        - SIP
        - DTMF</pre>
</div></div>

<h3><a name="TestConfiguration-fax%2Fgatewaymix4"></a>fax/gateway_mix4</h3>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">testinfo:
    summary: 'Test the fax gateway.'
    description: |
        This test verifies proper gateway functionality when a pass through
        t38 negotiation request fails. The sending side will reject the passed
        through negotiation request. The gateway should detect this respond to
        the receiving side as if no failure had occured and then gateway the
        fax.

        The call flow looks like this:
         |send        |
         |g711     t38|
         |-----------&gt;|
         |     gateway|
         |t38      t38|
         |&lt;-----------|
        \|receive     |/

properties:
    minversion: '10.0.0'
    dependencies:
        - python : 'twisted'
        - python : 'starpy'
        - custom : 'fax'
    tags:
        - fax
        - fax_gateway</pre>
</div></div>

<h3><a name="TestConfiguration-cdr%2Fcdruserfield"></a>cdr/cdr_userfield</h3>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">testinfo:
    summary: 'Test that Set(CDR(userfield)=...) works'
    description: |
        'Test that setting the userfield field in the CDR works'

test-modules:
    test-object:
        config-section: test-object-config
        typename: 'SimpleTestCase.SimpleTestCase'
    modules:
        -
            config-section: 'cdr-config'
            typename: 'cdr.CDRModule'

test-object-config:
    spawn-after-hangup: True
    test-iterations:
        -
            channel: 'Local/1@default'
            application: 'Echo'

cdr-config:
    -
        file: 'cdrtest_local'
        lines:
            -
                source: ''
                destination: '1'
                dcontext: 'default'
                callerid: ''
                channel: 'Local/1@default-.*'
                dchannel: ''
                lastapp: 'Hangup'
                lastarg: ''
                disposition: 'ANSWERED'
                amaflags: 'DOCUMENTATION'
                userfield: 'bazinga'

properties:
    minversion: '1.8.0.0'
    dependencies:
        - python : 'twisted'
        - python : 'starpy'
        - asterisk : 'cdr_csv'
    tags:
        - CDR
        - chan_local</pre>
</div></div>

    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;" class="grey">
                        <a href="https://wiki.asterisk.org/wiki/users/removespacenotification.action?spaceKey=AST">Stop watching space</a>
            <span style="padding: 0px 5px;">|</span>
                <a href="https://wiki.asterisk.org/wiki/users/editmyemailsettings.action">Change email notification preferences</a>
</div>
        <a href="https://wiki.asterisk.org/wiki/display/AST/Test+Configuration">View Online</a>
        |
        <a href="https://wiki.asterisk.org/wiki/pages/diffpagesbyversion.action?pageId=20185507&revisedVersion=4&originalVersion=3">View Changes</a>
                |
        <a href="https://wiki.asterisk.org/wiki/display/AST/Test+Configuration?showComments=true&amp;showCommentArea=true#addcomment">Add Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>