■Each test case method must take no arguments, and must return a Status object that represents the outcome of the test case. The Status can be either
Status.passed(String) or Status.failed(String).
■Developers must update the runTestCases() method to add the test cases that are executed.
This is a
■Each test in a test suite has a corresponding test description that is typically contained in an HTML file. The test description file contains all information required to run the test, such as the source file to use (source), the class to execute (executeClass), and how the test is executed (keyword).
▼To Create a Simple Automated Test
The following steps demonstrate how to create an automated test class suitable for CLDC, MIDP, and CDC (Test3.java), to create its test description file (index.html), and to update the test class dependencies file (testClasses.lst).
The test class, Test3.java, is a simple automated test class. This sample uses the SimpleTestSuite located at samples/sources/SimpleTestSuite/, not the AdvancedTestSuite.
This test class does not test a particular API. Instead, it is used to demonstrate the following aspects of creating a test class:
■The format of an automated test class
■How a test case method is implemented
■How a test case is selected in the runTestCases() method
■How each test case returns a Status object
■How to use ref to output reference information for debugging purpose
A text editor or an integrated development environment (IDE) of your choice is the only tool required to develop a test.
1. Enter the following test code into a text editor or IDE of your choice.
package sample.pkg3;
import com.sun.tck.cldc.lib.MultiTest; import com.sun.tck.cldc.lib.Status;
/**
* Sample test with simple test cases.