if (testSuite != null) {
testSuite.reportTestRetry();
}
}
TestResult testResult = initTestResult(data, requirements, trial, reportManager, ds.getData().indexOf(data), ds.getData().size());
testResults.add(testResult);
int timeout = DEFAULT_TIMEOUT;
if (debug) {
logger.info("Not using test timeout because running in debug mode");
} else {
try {
timeout = data.getIntValue("TIMEOUT");
logger.info("Using test timeout of " + timeout + " seconds");
timeout = timeout * 1000;
} catch (QTasteDataException e) {
if (e.getMessage().contains("doesn't contain")) {
logger.info("No TIMEOUT test data, using default test timeout (" + DEFAULT_TIMEOUT / 1000 + " seconds)");
} else {
logger.error(e.getMessage() + ". Using default test timeout (" + DEFAULT_TIMEOUT / 1000 + " seconds)");
}
}
}
TaskThread taskThread = new TaskThread(debug, data, testResult, timeout);
// clear cache history
CacheImpl.getInstance().clearHistory();
// initialize instantiated components
testAPI.initializeComponents();
testResult.start();
// wait till the end of the Task or Timeout
reportManager.putEntry(testResult);
taskThread.start();
boolean taskThreadTerminated = taskThread.waitForEnd();
reportManager.refresh();
// terminate instantiated components
testAPI.terminateComponents();
// exit QTaste if test thread couldn't be stopped, because we are in an unstable state
if (!taskThreadTerminated) {
JOptionPane.showMessageDialog(null, "Couldn't stop test thread!\nQTaste will now exit because system state is unstable.", "Fatal error", JOptionPane.ERROR_MESSAGE);
TestEngine.shutdown();
System.exit(1);
}
status = testResult.getStatus();
if (status != TestResult.Status.SUCCESS)
{
if (status == TestResult.Status.FAIL) {
needToRetry = TestEngine.setNeedToRestartSUT();
}