use of org.evosuite.coverage.method.MethodCoverageSuiteFitness in project evosuite by EvoSuite.
the class PrivateReflectionSystemTest method testPrivateConstructor.
private TestSuiteChromosome testPrivateConstructor() {
Properties.P_REFLECTION_ON_PRIVATE = 0.9;
Properties.REFLECTION_START_PERCENT = 0.0;
GeneticAlgorithm ga = do100percentLineTestOnStandardCriteriaWithMethodTrace(PrivateConstructor.class);
TestSuiteChromosome best = (TestSuiteChromosome) ga.getBestIndividual();
System.out.println("EvolvedTestSuite:\n" + best);
assertTrue(!best.getTests().isEmpty());
double cov = best.getCoverageInstanceOf(MethodCoverageSuiteFitness.class);
Assert.assertEquals("Non-optimal method coverage: ", 1d, cov, 0.001);
Optional<FitnessFunction<?>> ff = ga.getFitnessFunctions().stream().filter(m -> m instanceof MethodCoverageSuiteFitness).findAny();
assertEquals(1, best.getNumOfCoveredGoals(ff.get()));
cov = best.getCoverageInstanceOf(MethodTraceCoverageSuiteFitness.class);
Assert.assertEquals("Non-optimal method trace coverage: ", 1d, cov, 0.001);
ff = ga.getFitnessFunctions().stream().filter(m -> m instanceof MethodTraceCoverageSuiteFitness).findAny();
assertEquals(1, best.getNumOfCoveredGoals(ff.get()));
return best;
}
Aggregations