gambas-source-code/OriginalFiles/manual/unitrunner.html
Christof Thalhofer 5111def64b Unittest weiter
2015-10-31 09:22:52 +01:00

128 lines
4.4 KiB
HTML

<html>
<head>
<title>COMUnit Reference Manual: UnitRunner</title>
</head>
<body>
<h1>Class UnitRunner</h1>
<h2>Description:</h2>
<p>
The UnitRunner class serves two main purposes:
<ul>
<li>it enables the user to pick which test cases to run, thereby building the test suite
<li>it runs the tests and reports their results
</ul>
</p>
<p>
The UnitRunner is an ActiveX control that can be embedded in a test project form.
By adding instances of the TestContainers included in the test project, the user can select
which test cases to run. The user can choose to run all test cases from all TestContainers,
all test cases in a single TestContainer or a single test case.
</p>
<p>
When the UnitRunner is instructed to run it creates a TestSuite from the selected test case(s)
and executes it. It can executed the test suite using a supplied TestResult object -- or it
will create it's own TestResult if none is specified. The results of the tests are displayed
in the grid as the test cases run. In accordance with standard unit testing guidelines,
only failures and errors are reported. If nothing is reported for a test case, it is assumed
that the test case executed successfully.
</p>
<p>
The progress bar reports the number of test cases that have been executed. The progress bar
will remain green as long as no errors or failures have been encountered while executing the
test cases. If an error or failure has occurred, the progress bar will turn from green to red.
Unit tests are designed so that all tests should run successfully before the code is released.
The green progress bar is used as an indication that all tests have passed successfully.
</p>
<h2>Interface Implementation:</h2>
<ul>
<li>None</li>
</ul>
<h2>Known Subclasses:</h2>
<ul>
<li>None</li>
</ul>
<h2>Method Summary:</h2>
<table border="1" cellpadding="2" cellspacing="2">
<tr><th>Method:</th><th>Definition:</th></tr>
<tr>
<td><a href="#AddTestContainer">AddTestContainer</a></td>
<td>Public Function AddTestContainer(oTestContainer As ITestContainer)</td>
</tr>
<tr>
<td><a href="#Reset">Reset</a></td>
<td>Public Sub Reset()</td>
</tr>
<tr>
<td><a href="#Run">Run</a></td>
<td>Public Sub Run(Optional oTestResult As TestResult)</td>
</tr>
<tr>
<td><a href="#SetDefaultTestContainer">SetDefaultTestContainer</a></td>
<td>Public Sub SetDefaultTestContainer(oTestContainer As ITestContainer)</td>
</tr>
<tr>
<td><a href="#TestResult">TestResult</a></td>
<td>Public Property Get TestResult() As TestResult<br />
Public Property Set TestResult(oTestResult As TestResult)</td>
</tr>
<tr>
<td><a href="#TestSuite">TestSuite</a></td>
<td>Public Property Get TestSuite() As ITest</td>
</tr>
</table>
<h2>Methods:</h2>
<h3><a name="TestSuite">TestSuite</a></h3>
<dl>
<dt>Definition:</dt><dd>Public Property Get TestSuite() As ITest</dd>
<dt>Description:</dt><dd>Retrieve the TestSuite generated from the test cases that have been selected by the user.</dd>
</dl>
<hr />
<h3><a name="TestResult">TestResult</a></h3>
<dl>
<dt>Definition:</dt><dd>Public Property Get TestResult() As TestResult<br />
Public Property Set TestResult(oTestResult As TestResult)</dd>
<dt>Description:</dt><dd>Get/Set the TestResult to be used for capturing the results of running the tests.</dd>
</dl>
<hr />
<h3><a name="AddTestContainer">AddTestContainer</a></h3>
<dl>
<dt>Definition:</dt><dd>Public Function AddTestContainer(oTestContainer As ITestContainer)</dd>
<dt>Description:</dt><dd>Add a TestContainer to the UnitRunner so that the user can select test cases from it to execute.</dd>
</dl>
<hr />
<h3><a name="Run">Run</a></h3>
<dl>
<dt>Definition:</dt><dd>Public Sub Run(Optional oTestResult As TestResult)</dd>
<dt>Description:</dt><dd>Run the test cases that have been selected by the user using the specified TestResult.</dd>
</dl>
<hr />
<h3><a name="Reset">Reset</a></h3>
<dl>
<dt>Definition:</dt><dd>Public Sub Reset()</dd>
<dt>Description:</dt><dd>Resets the UnitRunner control clearing the results of the last test run.</dd>
</dl>
<hr />
<h3><a name="SetDefaultTestContainer">SetDefaultTestContainer</a></h3>
<dl>
<dt>Definition:</dt><dd>Public Sub SetDefaultTestContainer(oTestContainer As ITestContainer)</dd>
<dt>Description:</dt><dd>Specify the TestContainer to be selected by default when the UnitRunner starts up.</dd>
</dl>
</body>
</html>