CODE EXAMPLE 3-2Simple Test Class (Continued)

return Status.passed("OK");

else

return Status.failed("2 + 2 did not make 4");

}

}

}

Additional examples (Test1.java and Test2.java)can be found in the following Simple Test Suite directories:

SimpleTestSuite/tests/sample/pkg1/

SimpleTestSuite/tests/sample/pkg2/

Test Description file

Each subdirectory that contains one or more test classes must also contain a corresponding test description. The test description is contained in HTML format.

The test description file generally contains the following fields:

title - A descriptive string that identifies what the test does. The title appears in reports and in the harness status window.

source - List of source files of the test.

When the test sources are listed in this field, they can be accessed and viewed from the harness GUI.

executeClass- Specifies the name of the test’s executable class file. It is assumed to be located in the classes directory.

keywords - String tokens that can be associated with a given test.

They describe attributes or characteristics of the test (for example, how to execute the test, and whether it is a positive or negative test). Keywords are often used to select or deselect tests from a test run. The most common keywords are runtime and positive. See Chapter 4 for a description of the specific keywords required for the different types of tests that can compose a test suite.

See Appendix C for a summary list of the Framework test description fields and keywords.

classes Directory

The classes directory contains all of the compiled test classes and library classes required to run the tests.

Chapter 3 Test Suite Construction 27

Page 47
Image 47
Sun Microsystems 1.2 manual Classes Directory, Test Description file, Code Example 3-2Simple Test Class