use of org.evosuite.testcase.ExecutableChromosome in project evosuite by EvoSuite.
the class TestSuiteFitnessFunction method runTestSuite.
/**
* <p>
* runTestSuite
* </p>
*
* @param suite
* a {@link org.evosuite.testsuite.AbstractTestSuiteChromosome}
* object.
* @return a {@link java.util.List} object.
*/
protected List<ExecutionResult> runTestSuite(AbstractTestSuiteChromosome<? extends ExecutableChromosome> suite) {
List<ExecutionResult> results = new ArrayList<ExecutionResult>();
for (ExecutableChromosome chromosome : suite.getTestChromosomes()) {
// Only execute test if it hasn't been changed
if (chromosome.isChanged() || chromosome.getLastExecutionResult() == null) {
ExecutionResult result = chromosome.executeForFitnessFunction(this);
if (result != null) {
results.add(result);
// .clone();
chromosome.setLastExecutionResult(result);
chromosome.setChanged(false);
}
} else {
results.add(chromosome.getLastExecutionResult());
}
}
suite.setChanged(false);
return results;
}
use of org.evosuite.testcase.ExecutableChromosome in project evosuite by EvoSuite.
the class ReadabilitySuiteFitness method getFitness.
/**
*/
@Override
public double getFitness(AbstractTestSuiteChromosome<? extends ExecutableChromosome> suite) {
double average = 0.0;
for (ExecutableChromosome ec : suite.getTestChromosomes()) {
average += getScore(ec.toString());
}
average /= suite.getTestChromosomes().size();
updateIndividual(this, suite, average);
return average;
}
Aggregations