JsUnit |
A test case defines the fixture to run multiple tests. More...
Public Member Functions | |
void | TestCase (String name) |
Constructs a test case with the given name. More... | |
void | tearDown () |
Clear up the environment of the fixture. More... | |
void | setUp () |
Set up the environment of the fixture. More... | |
Public Member Functions inherited from Assert | |
void | Assert () |
Public Attributes | |
int | mName |
Additional Inherited Members | |
Protected Member Functions inherited from Test | |
virtual void | Test () |
virtual String | getName () |
Retrieves the name of the test. More... | |
virtual Test | findTest (String testName) |
Search a test by name. More... | |
virtual void | setName (String testName) |
Sets the name of the test. More... | |
virtual Number | countTestCases () |
Counts the number of test cases that will be run by this test. More... | |
virtual TestResult | run (TestResult result) |
Runs the test. More... | |
A test case defines the fixture to run multiple tests.
To define a test case
setUp
tearDown
. Each test runs in its own fixture so there can be no side effects among test runs.For each test implement a method which interacts with the fixture. Verify the expected results with assertions specified by calling assertTrue
with a boolean or one of the other assert functions.
Once the methods are defined you can run them. The framework supports both a static and more generic way to run a test. In the static way you override the runTest method and define the method to be invoked. The generic way uses the JavaScript functionality to enumerate a function's methods to implement runTest
. In this case the name of the case has to correspond to the test method to be run.
The tests to be run can be collected into a TestSuite. JsUnit provides several test runners which can run a test suite and collect the results. A test runner expects a function FileNameSuite
as the entry point to get a test to run.
void TestCase::TestCase | ( | String | name | ) |
Constructs a test case with the given name.
name | The name of the test case. |
void TestCase::setUp | ( | ) |
Set up the environment of the fixture.
void TestCase::tearDown | ( | ) |
Clear up the environment of the fixture.
int TestCase::mName |
JsUnit © 1999, 2000, 2001, 2002, 2003, 2006, 2007 by Jörg Schaible
|
Generated on Wed Apr 15 2015 02:33:07 for JsUnit by doxygen 1.8.5
|