Home Corporate Contacts TETware Knowledgebase |
ProductsSolutionsInformationDatasheetDocumentationFAQKnowledgebase |
Return to Knowledgebase Index39. How to create a new thread in a Java API-conforming test case
Question I have a test program looks like this: public class test { public static void main(String args[]) { new testThread().start(); } } class testThread extends Thread { public void run() { // the test program is here. } }
Answer When you create a new thread in a program that uses the TETware Java API, instead of saying class testThread extends Thread class testThread extends TetThread Here is an example of a simple test case that creates a new thread: import java.lang.*; import TET.*; Here is the journal output when this test case is run: 0|3.4ea 12:38:06 19990928|User: tet (106) TCC Start, \ Command line: tcc -epl /ts/tc1/ThrTest 5|Linux fir 2.0.35 #6 Sat Mar 13 09:21:49 GMT 1999 i686| \ Local System Information 20|/home/tet/jtests/tetexec.cfg 1|Config Start 30||TET_EXPAND_CONF_VARS=true 30||TET_OUTPUT_CAPTURE=true 30||TET_API_COMPLIANT=true 30||TET_EXEC_IN_PLACE=true 30||TET_EXEC_TOOL=ksh 30||TET_EXEC_FILE=/home/tet/jtests/exectool.ksh 30||TET_JAVA_PATH=/usr/local/java/bin/java 30||TET_PASS_TC_NAME=True 30||TET_VERSION=3.4ea 40||Config End 10|0 /ts/tc1/ThrTest 12:38:06|TC Start, scenario ref 1-0 15|0 3.4ea 1|TCM Start 400|0 1 1 12:38:06|IC Start 200|0 1 12:38:06|TP Start 520|0 1 00030029 1 1|This is the parent thread: \ Thread[main,5,main] 520|0 1 00030029 1 2|Parent printing child thread: \ Thread[TestThread() #1,5,TET:ThrTest:IC1TP1] 520|0 1 00030029 1 3|parent thread returns 520|0 1 00030029 2 1|Child thread \ (Thread[TestThread() #1,5,TET:ThrTest:IC1TP1]): \ starting to run 520|0 1 00030029 2 2|Child thread \ (Thread[TestThread() #1,5,TET:ThrTest:IC1TP1]) exits 220|0 1 0 12:38:11|PASS 410|0 1 1 12:38:11|IC End 80|0 0 12:38:12|TC End, scenario ref 1-0 900|12:38:12|TCC End
See also
|