JsUnit 1.3
Project Developer Home doxygen

TestCase Class Reference

Inheritance diagram for TestCase:

Inheritance graph
[legend]
Collaboration diagram for TestCase:

Collaboration graph
[legend]
List of all members.

Detailed Description

A test case defines the fixture to run multiple tests.

To define a test case

  1. implement a subclass of TestCase
  2. define instance variables that store the state of the fixture
  3. initialize the fixture state by overriding setUp
  4. clean-up after a test by overriding 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.

See also:
TestResult

TestSuite


Public Member Functions

void TestCase (String name)
 Constructs a test case with the given name.
void setUp ()
 Set up the environment of the fixture.
void tearDown ()
 Clear up the environment of the fixture.

Public Attributes

int mName


Constructor & Destructor Documentation

void TestCase::TestCase ( String  name  ) 

Constructs a test case with the given name.

Parameters:
name The name of the test case.


Member Function Documentation

void TestCase::setUp (  ) 

Set up the environment of the fixture.

void TestCase::tearDown (  ) 

Clear up the environment of the fixture.


Member Data Documentation

int TestCase::mName


The documentation for this class was generated from the following file:
JsUnit © 1999, 2000, 2001, 2002, 2003, 2006, 2007 by Jörg Schaible
Generated on Fri Oct 19 23:11:25 2007 for JsUnit by doxygen 1.5.2