use of org.evosuite.coverage.exception.ExceptionCoverageTestFitness in project evosuite by EvoSuite.
the class MOSA method calculateFitness.
/**
* {@inheritDoc}
*/
@Override
@SuppressWarnings("unchecked")
protected void calculateFitness(T c) {
for (FitnessFunction<T> fitnessFunction : this.fitnessFunctions) {
double value = fitnessFunction.getFitness(c);
if (value == 0.0) {
// ((TestChromosome)c).addCoveredGoals(fitnessFunction);
updateArchive(c, fitnessFunction);
}
}
if (ArrayUtil.contains(Properties.CRITERION, Criterion.EXCEPTION)) {
// if one of the coverage criterion is Criterion.EXCEPTION,
// then we have to analyze the results of the execution do look
// for generated exceptions
List<ExceptionCoverageTestFitness> list = deriveCoveredExceptions(c);
for (ExceptionCoverageTestFitness exp : list) {
// new covered exceptions (goals) have to be added to the archive
updateArchive(c, (FitnessFunction<T>) exp);
if (!fitnessFunctions.contains(exp)) {
// let's update the list of fitness functions
this.fitnessFunctions.add((FitnessFunction<T>) exp);
// let's update the newly discovered exceptions to ExceptionCoverageFactory
ExceptionCoverageFactory.getGoals().put(exp.toString(), exp);
}
}
}
notifyEvaluation(c);
// update the time needed to reach the max coverage
budgetMonitor.checkMaxCoverage(this.archive.keySet().size());
}
Aggregations