ITestCase[] testCases = new ITestCase[4];
for (int i = 0; i < testCases.length; i++) {
final int num = i;
testCases[i] = new ITestCase() {
private final StopWatch stopWatch = new StopWatch();
private final LogRecorder logRecorder = new LogRecorder(System.out);
@Override
public String getBaseName() {
return getName();
}
@Override
public String getName() {
return "test-case" + num;
}
@Override
public boolean isError() {
return false;
}
@Override
public StopWatch getStopWatch() {
return stopWatch;
}
@Override
public void setLogRecorder(LogRecorder logRecorder) {
throw new UnsupportedOperationException();
}
@Override
public LogRecorder getLogRecorder() {
return logRecorder;
}
};
}
jur.startTestSuite(testSuite);
jur.addProperty(testSuite, "prop-name1", "prop-value1");
jur.addProperty(testSuite, "prop-name2", "prop-value2");
jur.addProperty(testSuite, "prop-name3", "prop-value3");
ITestCase tc;
StopWatch sw;
LogRecorder clr;
tc = testCases[0];
sw = tc.getStopWatch();
clr = tc.getLogRecorder();
jur.startTestCase(testSuite, tc);
testSuite.getStopWatch().start();
sw.start();
jur.setSuccess(tc);
clr.info("systemOut00");
clr.error("systemErr00");
clr.info("systemOut01");
clr.error("systemErr01");
clr.info("systemOut02");
clr.error("systemErr02");
Thread.sleep(100);
sw.end();
jur.endTestCase(tc);
tc = testCases[1];
sw = tc.getStopWatch();
clr = tc.getLogRecorder();
jur.startTestCase(testSuite, tc);
sw.start();
jur.setError(tc, "detail1", "trace1");
clr.info("systemOut1");
clr.error("systemErr1");
Thread.sleep(50);
sw.end();
jur.endTestCase(tc);
tc = testCases[2];
sw = tc.getStopWatch();
clr = tc.getLogRecorder();
jur.startTestCase(testSuite, tc);
sw.start();
jur.setFailure(tc, "detail2", "trace2");
clr.info("systemOut2");
clr.error("systemErr2");
Thread.sleep(10);
sw.end();
jur.endTestCase(tc);
tc = testCases[3];
sw = tc.getStopWatch();