use of org.evosuite.result.TestGenerationResult in project evosuite by EvoSuite.
the class AmbiguityFitnessSystemTest method testZeroAmbiguityScore.
@Test
public void testZeroAmbiguityScore() {
EvoSuite evosuite = new EvoSuite();
String targetClass = Compositional.class.getCanonicalName();
Properties.TARGET_CLASS = targetClass;
String[] command = new String[] { "-class", targetClass, "-generateSuite" };
List<List<TestGenerationResult>> result = (List<List<TestGenerationResult>>) evosuite.parseCommandLine(command);
Assert.assertNotNull(result);
List<?> goals = AmbiguityCoverageFactory.getGoals();
assertEquals(12, goals.size());
GeneticAlgorithm<?> ga = result.get(0).get(0).getGeneticAlgorithm();
Assert.assertNotNull(ga);
assertEquals(0.0, ga.getBestIndividual().getFitnessInstanceOf(AmbiguityCoverageSuiteFitness.class), 0.0);
}
use of org.evosuite.result.TestGenerationResult in project evosuite by EvoSuite.
the class AmbiguityFitnessSystemTest method testZeroAmbiguityScoreWithPreviousCoverage.
@Test
public void testZeroAmbiguityScoreWithPreviousCoverage() {
EvoSuite evosuite = new EvoSuite();
String targetClass = Compositional.class.getCanonicalName();
Properties.TARGET_CLASS = targetClass;
String previous_tmp_coverage = "1 1 1 1 1 1 1 1 1 1 1 +\n" + "1 1 1 1 0 0 0 0 0 0 0 -\n";
this.writeMatrix(previous_tmp_coverage);
Properties.USE_EXISTING_COVERAGE = true;
String[] command = new String[] { "-class", targetClass, "-generateSuite" };
List<List<TestGenerationResult>> result = (List<List<TestGenerationResult>>) evosuite.parseCommandLine(command);
Assert.assertNotNull(result);
List<?> goals = AmbiguityCoverageFactory.getGoals();
assertEquals(12, goals.size());
GeneticAlgorithm<?> ga = result.get(0).get(0).getGeneticAlgorithm();
Assert.assertNotNull(ga);
assertEquals(0.0, ga.getBestIndividual().getFitnessInstanceOf(AmbiguityCoverageSuiteFitness.class), 0.0);
}
use of org.evosuite.result.TestGenerationResult in project evosuite by EvoSuite.
the class TestShouldNotWorkSystemTest method testJavaPackageNotOnProjectCP.
@SuppressWarnings("unchecked")
@Test
public void testJavaPackageNotOnProjectCP() {
EvoSuite evosuite = new EvoSuite();
String targetClass = java.util.TreeMap.class.getCanonicalName();
Properties.TARGET_CLASS = targetClass;
String[] command = new String[] { "-generateSuite", "-class", targetClass };
Object result = evosuite.parseCommandLine(command);
// List<TestGenerationResult> results = (List<TestGenerationResult>)result;
List<List<TestGenerationResult>> results = (List<List<TestGenerationResult>>) result;
assertEquals(1, results.size());
// TestGenerationResult testResult = results.iterator().next();
TestGenerationResult testResult = results.get(0).get(0);
System.out.println(testResult.getErrorMessage());
assertFalse(testResult.getErrorMessage().isEmpty());
assertEquals(TestGenerationResult.Status.ERROR, testResult.getTestGenerationStatus());
}
Aggregations