Search in sources :

Example 21 with SearchStatistics

use of org.evosuite.statistics.SearchStatistics in project evosuite by EvoSuite.

the class CoverageAnalysisSystemTest method testRhoCoverage.

@Test
public void testRhoCoverage() {
    SearchStatistics statistics = this.aux(new Properties.Criterion[] { Properties.Criterion.RHO });
    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);
}
Also used : SearchStatistics(org.evosuite.statistics.SearchStatistics) Properties(org.evosuite.Properties) OutputVariable(org.evosuite.statistics.OutputVariable) Test(org.junit.Test)

Example 22 with SearchStatistics

use of org.evosuite.statistics.SearchStatistics in project evosuite by EvoSuite.

the class CoverageAnalysisSystemTest method aux.

private SearchStatistics aux(Criterion[] criterion) {
    EvoSuite evosuite = new EvoSuite();
    String targetClass = BMICalculator.class.getCanonicalName();
    String testClass = TestBMICalculator.class.getCanonicalName();
    Properties.TARGET_CLASS = targetClass;
    Properties.CRITERION = criterion;
    String[] command = new String[] { "-class", targetClass, "-Djunit=" + testClass, "-measureCoverage" };
    SearchStatistics statistics = (SearchStatistics) evosuite.parseCommandLine(command);
    Assert.assertNotNull(statistics);
    return statistics;
}
Also used : SearchStatistics(org.evosuite.statistics.SearchStatistics) EvoSuite(org.evosuite.EvoSuite)

Example 23 with SearchStatistics

use of org.evosuite.statistics.SearchStatistics in project evosuite by EvoSuite.

the class CoverageAnalysisOfEvoSuiteTestSuiteSystemTest method testOneFitnessFunction.

@Test
public void testOneFitnessFunction() {
    EvoSuite evosuite = new EvoSuite();
    String targetClass = Euclidean.class.getCanonicalName();
    Properties.TARGET_CLASS = targetClass;
    Properties.CRITERION = new Criterion[] { Criterion.BRANCH };
    String[] command = new String[] { "-class", targetClass, "-Djunit=" + targetClass + Properties.JUNIT_SUFFIX, "-measureCoverage" };
    SearchStatistics statistics = (SearchStatistics) evosuite.parseCommandLine(command);
    Assert.assertNotNull(statistics);
    Map<String, OutputVariable<?>> data = statistics.getOutputVariables();
    assertEquals(5, (Integer) data.get("Total_Goals").getValue(), 0.0);
    assertEquals(5, (Integer) data.get("Covered_Goals").getValue(), 0.0);
}
Also used : SearchStatistics(org.evosuite.statistics.SearchStatistics) EvoSuite(org.evosuite.EvoSuite) OutputVariable(org.evosuite.statistics.OutputVariable) Test(org.junit.Test)

Aggregations

SearchStatistics (org.evosuite.statistics.SearchStatistics)23 Test (org.junit.Test)22 Properties (org.evosuite.Properties)21 OutputVariable (org.evosuite.statistics.OutputVariable)19 EvoSuite (org.evosuite.EvoSuite)16 CalculatorTest (com.examples.with.different.packagename.CalculatorTest)5 ClassNumberUtilsTest (com.examples.with.different.packagename.ClassNumberUtilsTest)3 ClassWithPrivateInterfacesTest (com.examples.with.different.packagename.ClassWithPrivateInterfacesTest)3 FinalClassTest (com.examples.with.different.packagename.FinalClassTest)3 StringUtilsEqualsIndexOfTest (com.examples.with.different.packagename.StringUtilsEqualsIndexOfTest)3 WordUtilsTest (com.examples.with.different.packagename.WordUtilsTest)3 CSVReader (com.opencsv.CSVReader)3 FileReader (java.io.FileReader)3 Ignore (org.junit.Ignore)2 ClassHierarchyIncludingInterfacesTest (com.examples.with.different.packagename.ClassHierarchyIncludingInterfacesTest)1 ClassPublicInterfaceTest (com.examples.with.different.packagename.ClassPublicInterfaceTest)1