use of org.evosuite.coverage.TestFitnessFactory in project evosuite by EvoSuite.
the class MockTcpSystemTest method testReceiveTcp_noBranch.
// TODO put back once we properly handle boolean functions with TT
@Ignore
@Test
public void testReceiveTcp_noBranch() {
EvoSuite evosuite = new EvoSuite();
/*
as there is no branch, covering both boolean outputs with online line coverage
would not be possible. and so output coverage would be a necessity
*/
String targetClass = ReceiveTcp_noBranch.class.getCanonicalName();
Properties.TARGET_CLASS = targetClass;
Properties.SEARCH_BUDGET = 20000;
Properties.VIRTUAL_NET = true;
Properties.CRITERION = new Properties.Criterion[] { Properties.Criterion.LINE, Properties.Criterion.OUTPUT };
String[] command = new String[] { "-generateSuite", "-class", targetClass };
Object result = evosuite.parseCommandLine(command);
Assert.assertTrue(result != null);
GeneticAlgorithm<?> ga = getGAFromResult(result);
TestSuiteChromosome best = (TestSuiteChromosome) ga.getBestIndividual();
System.out.println("EvolvedTestSuite:\n" + best);
List<TestFitnessFactory<? extends TestFitnessFunction>> list = TestGenerationStrategy.getFitnessFactories();
Assert.assertEquals(2, list.size());
Assert.assertEquals("Non-optimal coverage: ", 1d, best.getCoverage(), 0.001);
}
Aggregations