use of org.evosuite.coverage.io.input.InputObserver in project evosuite by EvoSuite.
the class CoverageGoalTestNameGenerationStrategy method getUpdatedResults.
/**
* Some criteria require re-execution with observers. Make sure the results are up-to-date
*
* @param requiredCriteria
* @param origResults
* @return
*/
private List<ExecutionResult> getUpdatedResults(List<Properties.Criterion> requiredCriteria, List<ExecutionResult> origResults) {
List<ExecutionObserver> newObservers = new ArrayList<ExecutionObserver>();
if (requiredCriteria.contains(Properties.Criterion.INPUT)) {
newObservers.add(new InputObserver());
}
if (requiredCriteria.contains(Properties.Criterion.OUTPUT)) {
newObservers.add(new OutputObserver());
}
if (newObservers.isEmpty()) {
return origResults;
}
for (ExecutionObserver observer : newObservers) TestCaseExecutor.getInstance().addObserver(observer);
List<ExecutionResult> newResults = new ArrayList<ExecutionResult>();
for (ExecutionResult result : origResults) {
ExecutionResult newResult = TestCaseExecutor.getInstance().runTest(result.test);
newResults.add(newResult);
}
for (ExecutionObserver observer : newObservers) TestCaseExecutor.getInstance().removeObserver(observer);
return newResults;
}
Aggregations