Search in sources :

Example 41 with OutputVariable

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

the class CoverageAnalysisOfClassSystemTest method testOneClassOneCriterion.

@Test
public void testOneClassOneCriterion() {
    EvoSuite evosuite = new EvoSuite();
    String targetClass = Calculator.class.getCanonicalName();
    String testClass = CalculatorTest.class.getCanonicalName();
    Properties.TARGET_CLASS = targetClass;
    Properties.CRITERION = new Properties.Criterion[] { Properties.Criterion.BRANCH };
    String[] command = new String[] { "-class", targetClass, "-Djunit=" + testClass, "-measureCoverage" };
    SearchStatistics statistics = (SearchStatistics) evosuite.parseCommandLine(command);
    Assert.assertNotNull(statistics);
    Map<String, OutputVariable<?>> outputVariables = statistics.getOutputVariables();
    assertEquals(0.80, (Double) outputVariables.get("BranchCoverage").getValue(), 0.0);
    assertEquals(0.80, (Double) outputVariables.get("Coverage").getValue(), 0.0);
    assertEquals(4, (Integer) outputVariables.get("Tests_Executed").getValue(), 0);
    assertEquals(4, (Integer) outputVariables.get("Covered_Goals").getValue(), 0);
    assertEquals(5, (Integer) outputVariables.get("Total_Goals").getValue(), 0);
    assertEquals("10111", outputVariables.get("BranchCoverageBitString").getValue());
}
Also used : SearchStatistics(org.evosuite.statistics.SearchStatistics) EvoSuite(org.evosuite.EvoSuite) Properties(org.evosuite.Properties) OutputVariable(org.evosuite.statistics.OutputVariable) Test(org.junit.Test) CalculatorTest(com.examples.with.different.packagename.CalculatorTest)

Example 42 with OutputVariable

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

the class CoverageAnalysisSystemTest method testBranchCoverage.

@Test
public void testBranchCoverage() {
    SearchStatistics statistics = this.aux(new Properties.Criterion[] { Properties.Criterion.BRANCH });
    Map<String, OutputVariable<?>> variables = statistics.getOutputVariables();
    assertEquals(9, (Integer) variables.get("Total_Goals").getValue(), 0.0);
    assertEquals(9, (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 43 with OutputVariable

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

the class CoverageAnalysisSystemTest method testLineCoverage.

@Test
public void testLineCoverage() {
    SearchStatistics statistics = this.aux(new Properties.Criterion[] { Properties.Criterion.LINE });
    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 44 with OutputVariable

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

the class CoverageAnalysisSystemTest method testCBranchCoverage.

@Test
public void testCBranchCoverage() {
    SearchStatistics statistics = this.aux(new Properties.Criterion[] { Properties.Criterion.CBRANCH });
    Map<String, OutputVariable<?>> variables = statistics.getOutputVariables();
    assertEquals(9, (Integer) variables.get("Total_Goals").getValue(), 0.0);
    assertEquals(9, (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 45 with OutputVariable

use of org.evosuite.statistics.OutputVariable 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)

Aggregations

OutputVariable (org.evosuite.statistics.OutputVariable)71 Test (org.junit.Test)67 EvoSuite (org.evosuite.EvoSuite)61 TestSuiteChromosome (org.evosuite.testsuite.TestSuiteChromosome)49 SearchStatistics (org.evosuite.statistics.SearchStatistics)19 Properties (org.evosuite.Properties)18 CheapPurityAnalyzer (org.evosuite.assertion.CheapPurityAnalyzer)13 CalculatorTest (com.examples.with.different.packagename.CalculatorTest)2 Ignore (org.junit.Ignore)2 ClassHierarchyIncludingInterfacesTest (com.examples.with.different.packagename.ClassHierarchyIncludingInterfacesTest)1 ClassNumberUtilsTest (com.examples.with.different.packagename.ClassNumberUtilsTest)1 ClassPublicInterfaceTest (com.examples.with.different.packagename.ClassPublicInterfaceTest)1 ClassWithPrivateInterfacesTest (com.examples.with.different.packagename.ClassWithPrivateInterfacesTest)1 FinalClassTest (com.examples.with.different.packagename.FinalClassTest)1 StringUtilsEqualsIndexOfTest (com.examples.with.different.packagename.StringUtilsEqualsIndexOfTest)1 WordUtilsTest (com.examples.with.different.packagename.WordUtilsTest)1 AbstractInspector (com.examples.with.different.packagename.purity.AbstractInspector)1 AbstractToStringInspector (com.examples.with.different.packagename.purity.AbstractToStringInspector)1