<html>
<head>
<base href="https://wiki.asterisk.org/wiki">
<link rel="stylesheet" href="/wiki/s/en/2172/18/9/_/styles/combined.css?spaceKey=AST&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+Hierarchy">Test Hierarchy</a></h2>
<h4>Page <b>edited</b> by <a href="https://wiki.asterisk.org/wiki/display/~mjordan">Matt Jordan</a>
</h4>
<br/>
<h4>Changes (3)</h4>
<div id="page-diffs">
<table class="diff" cellpadding="0" cellspacing="0">
<tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">Tests are discovered by the _runtests.py_ script during run time of the Asterisk Test Suite. The available tests and their locations are defined in _tests.yaml_ files. The first _tests.yaml_ file searched by the _runtests_ script is always _tests/tests.yaml_. <br></td></tr>
<tr><td class="diff-added-lines" style="background-color: #dfd;">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|http://www.yaml.org/] 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. <br></td></tr>
<tr><td class="diff-unchanged" > <br></td></tr>
<tr><td class="diff-added-lines" style="background-color: #dfd;">Test directories specified in a _tests.yaml_ file are processed in the following way: <br># 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. <br># 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. <br> <br></td></tr>
<tr><td class="diff-unchanged" >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. <br> <br></td></tr>
<tr><td class="diff-snipped" >...<br></td></tr>
</table>
</div> <h4>Full Content</h4>
<div class="notificationGreySide">
<p>Tests are discovered by the <em>runtests.py</em> script during run time of the Asterisk Test Suite. When it starts, the <em>runtests</em> script parses a <a href="http://www.yaml.org/" class="external-link" rel="nofollow">YAML</a> file, <em>tests/tests.yaml</em>, to determine what tests are in the Test Suite. The <em>tests.yaml</em> 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 <em>runtests</em> script looks for another <em>tests.yaml</em> file in that directory, and parses it to look for more tests. This recursive process continues until no more <em>tests.yaml</em> files are found.</p>
<p>Test directories specified in a <em>tests.yaml</em> file are processed in the following way:</p>
<ol>
        <li>If a test directory contains an executable <em>run-test</em> 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.</li>
        <li>If no <em>run-test</em> script is in the test directory, an instance of <em>TestRunner.py</em> is spawned instead. The test directory is passed to <em>TestRunner.py</em> as the test to execute.</li>
</ol>
<p>A <em>tests.yaml</em> file always contains the the keyword <b>tests</b>, which contains a sequence of directories to search for more tests in and test directories to execute.</p>
<h2><a name="TestHierarchy-Specification"></a>Specification</h2>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'>Keyword</th>
<th class='confluenceTh'>Value</th>
<th class='confluenceTh'>Required</th>
</tr>
<tr>
<td class='confluenceTd'> tests </td>
<td class='confluenceTd'> A sequence of 'test' or 'dir' key/value pairs </td>
<td class='confluenceTd'> Yes </td>
</tr>
</tbody></table>
</div>
<h3><a name="TestHierarchy-testsAllowedValues"></a>tests Allowed Values</h3>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'>Keyword</th>
<th class='confluenceTh'>Value</th>
<th class='confluenceTh'>Required</th>
</tr>
<tr>
<td class='confluenceTd'> test </td>
<td class='confluenceTd'> Specifies a test directory to execute </td>
<td class='confluenceTd'> No </td>
</tr>
<tr>
<td class='confluenceTd'> dir </td>
<td class='confluenceTd'> Specifies a directory to search for more tests </td>
<td class='confluenceTd'> No </td>
</tr>
</tbody></table>
</div>
<h2><a name="TestHierarchy-Example"></a>Example</h2>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false">tests:
- test: 'example'
- test: 'dynamic-modules'
- dir: 'manager'
- test: 'rfc2833_dtmf_detect'
- dir: 'iax2'
- dir: 'cdr'</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+Hierarchy">View Online</a>
|
<a href="https://wiki.asterisk.org/wiki/pages/diffpagesbyversion.action?pageId=20185464&revisedVersion=4&originalVersion=3">View Changes</a>
|
<a href="https://wiki.asterisk.org/wiki/display/AST/Test+Hierarchy?showComments=true&showCommentArea=true#addcomment">Add Comment</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>