Sun Microsystems 1.2 Telephone Accessories User Manual


 
Chapter 2 Writing a Simple Automated Test 17
2. Save this file in the Simple Test Suite source as
SimpleTestSuite/tests/pkg3/Test3.java.
The pkg3 folder does not exist in SimpleTestSuite/tests and can be created
by the test developer when saving Test3.java. Sources for the tests should be
placed inside the tests directory of the test suite and organized by package.
3. Enter the following HTML code into a text editor or IDE of your choice.
*/
public class Test3 extends MultiTest {
protected void runTestCases() {
if (isSelected("helloWorld")) {
addStatus(helloWorld());
}
}
public Status helloWorld() {
String message1 = new String("Hello World !");
String message2 = new String("Hello World !");
ref.println("message1: "+message1);
ref.println("message2: "+message2);
if (!message2.equals(message1)) {
return Status.failed("Failed: see ref for details");
}
return Status.passed("OK");
}
}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Test Specifications and Descriptions for Test3</TITLE>
</HEAD>
<BODY>
<H1>Test Specifications and Descriptions for Test3</H1>
<HR>
<a name="Test3"></a>
<TABLE BORDER=1 SUMMARY="JavaTest Test Description" CLASS=TestDescription>
<THEAD><TR><TH SCOPE="col">Item</TH><TH SCOPE="col">Value</TH></TR></THEAD>
<TR>
<TD SCOPE="row"> <B>title</B> </TD>
<TD> Hello World ! test</TD>
</TR>
<TR>
<TD SCOPE="row"> <B>source</B> </TD>
<TD> <A HREF="Test3.java">Test3.java</A> </TD>
</TR>