use of org.evosuite.statistics.OutputVariable in project evosuite by EvoSuite.
the class CoverageAnalysisSystemTest method testAmbiguityCoverage.
@Test
public void testAmbiguityCoverage() {
SearchStatistics statistics = this.aux(new Properties.Criterion[] { Properties.Criterion.AMBIGUITY });
Map<String, OutputVariable<?>> variables = statistics.getOutputVariables();
assertEquals(11, (Integer) variables.get("Total_Goals").getValue(), 0.0);
assertEquals(11, (Integer) variables.get("Covered_Goals").getValue(), 0.0);
}
use of org.evosuite.statistics.OutputVariable in project evosuite by EvoSuite.
the class CoverageAnalysisSystemTest method testOnlyLineCoverage.
@Test
public void testOnlyLineCoverage() {
SearchStatistics statistics = this.aux(new Properties.Criterion[] { Properties.Criterion.ONLYLINE });
Map<String, OutputVariable<?>> variables = statistics.getOutputVariables();
assertEquals(11, (Integer) variables.get("Total_Goals").getValue(), 0.0);
assertEquals(11, (Integer) variables.get("Covered_Goals").getValue(), 0.0);
}
use of org.evosuite.statistics.OutputVariable in project evosuite by EvoSuite.
the class CoverageAnalysisSystemTest method testOnlyBranchCoverage.
@Test
public void testOnlyBranchCoverage() {
SearchStatistics statistics = this.aux(new Properties.Criterion[] { Properties.Criterion.ONLYBRANCH });
Map<String, OutputVariable<?>> variables = statistics.getOutputVariables();
assertEquals(8, (Integer) variables.get("Total_Goals").getValue(), 0.0);
assertEquals(8, (Integer) variables.get("Covered_Goals").getValue(), 0.0);
}
use of org.evosuite.statistics.OutputVariable in project evosuite by EvoSuite.
the class StaticUninitializedFieldSystemTest method test.
@Test
public void test() {
EvoSuite evosuite = new EvoSuite();
String targetClass = StaticFieldUninitialized.class.getCanonicalName();
Properties.TARGET_CLASS = targetClass;
String[] command = new String[] { "-generateSuite", "-class", targetClass };
Object result = evosuite.parseCommandLine(command);
GeneticAlgorithm<?> ga = getGAFromResult(result);
TestSuiteChromosome best = (TestSuiteChromosome) ga.getBestIndividual();
System.out.println(best.toString());
Map<String, OutputVariable<?>> map = DebugStatisticsBackend.getLatestWritten();
Assert.assertNotNull(map);
OutputVariable unstable = map.get(RuntimeVariable.HadUnstableTests.toString());
Assert.assertNotNull(unstable);
Assert.assertEquals("Unexpected unstabled test cases were generated", Boolean.FALSE, unstable.getValue());
double best_fitness = best.getFitness();
Assert.assertTrue("Optimal coverage was not achieved ", best_fitness == 0.0);
}
use of org.evosuite.statistics.OutputVariable in project evosuite by EvoSuite.
the class UnstableAssertionSystemTest method test.
@Test
public void test() {
EvoSuite evosuite = new EvoSuite();
String targetClass = UnstableAssertion.class.getCanonicalName();
Properties.TARGET_CLASS = targetClass;
Properties.OUTPUT_VARIABLES = "" + RuntimeVariable.HadUnstableTests;
String[] command = new String[] { "-generateSuite", "-class", targetClass };
Object result = evosuite.parseCommandLine(command);
GeneticAlgorithm<?> ga = getGAFromResult(result);
TestSuiteChromosome best = (TestSuiteChromosome) ga.getBestIndividual();
System.out.println("EvolvedTestSuite:\n" + best);
double best_fitness = best.getFitness();
Assert.assertTrue("Optimal coverage was not achieved ", best_fitness == 0.0);
Map<String, OutputVariable<?>> map = DebugStatisticsBackend.getLatestWritten();
Assert.assertNotNull(map);
OutputVariable<?> unstable = map.get(RuntimeVariable.HadUnstableTests.toString());
Assert.assertNotNull(unstable);
Assert.assertEquals(Boolean.FALSE, unstable.getValue());
}
Aggregations