use of org.evosuite.testcase.TestCaseExecutor in project evosuite by EvoSuite.
the class ReportGenerator method executeTest.
/**
* <p>
* executeTest
* </p>
*
* @param testChromosome
* a {@link org.evosuite.testcase.TestChromosome} object.
* @param className
* a {@link java.lang.String} object.
* @return a {@link org.evosuite.testcase.ExecutionResult} object.
*/
public ExecutionResult executeTest(TestChromosome testChromosome, String className) {
ExecutionResult result = testChromosome.getLastExecutionResult();
if (result == null || testChromosome.isChanged()) {
try {
if (logger.isTraceEnabled()) {
logger.trace(testChromosome.getTestCase().toCode());
}
TestCaseExecutor executor = TestCaseExecutor.getInstance();
result = executor.execute(testChromosome.getTestCase());
} catch (Exception e) {
logger.error("TG: Exception caught: " + e.getMessage(), e);
try {
Thread.sleep(1000);
result.setTrace(ExecutionTracer.getExecutionTracer().getTrace());
} catch (Exception e1) {
logger.error("Cannot set trace in test case with exception. Going to kill client", e1);
throw new Error(e1);
}
}
}
StatisticEntry entry = statistics.get(statistics.size() - 1);
entry.results.put(testChromosome.getTestCase(), result.getCopyOfExceptionMapping());
return result;
}
Aggregations