??RFT?????????????
???????????? ???????[ 2012/10/30 10:50:12 ] ????????
?????????????????н??г?????
??????????????????????????е?????????????????? RFT ??? freeze ??????????????????????У?????????????????????????? RFT ??????????????????AUT ??????????????????????????? AUT ???????????y?????????С??????????????????????????????????????????? RFT ????????????????????????????д?????????????????????
??????????????????? Helper Superclass ?У???????嵥 6 ???????????????????????????? Timer?? ???????????????趨???onTimeout ????????????????????б??????
?????嵥 6.
/**
* ??? timeout ?? Helper Superclass
*/
public class TestScriptHelper extends RationalTestScript {
private static Timer timer = new Timer(true);
private static TimerTask timerTask = null;
private long timeout = 0;
/**
* ???y?????????????λ???* @param timeout ??? timeout <= 0?????????????????
*/
public void setTimeout(long timeout) {
this.timeout = timeout;
}
public void onInitialize() {
if (timeout > 0) {
if (timerTask != null)
timerTask.cancel();
timerTask = new TimerTask(){
public void run() {
onTimeout();
// ????????????
TestContext.getRunningTestContext().setAbort("Timeout");
}
};
timer.schedule(timerTask?? 1000 * timeout);
}
}
public void onTerminate() {
if (timerTask != null) {
timerTask.cancel();
timerTask = null;
}
}
/**
* ??????????????÷??????????????????? .
*/
public void onTimeout() {
}
}
?????????嵥 7 ???????????????????ó???????? DemoScript ?? Helper Superclass ? TestScriptHelper??????????????????? setTimeout ?????????????????
?????嵥 7.
package testcases;
import resources.testcases.DemoScriptHelper;
public class DemoScript extends DemoScriptHelper {
public DemoScript() {
setTimeout(3);
}
public void onTimeout() {
System.out.println("DemoScript runs out of time!");
//TODO ????????????? kill ??????????????????
}
public void testMain(Object[] args) {
sleep(20);
//TODO ?????????
}
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11