Search in sources :

Example 26 with BranchCoverageSuiteFitness

use of org.evosuite.coverage.branch.BranchCoverageSuiteFitness in project evosuite by EvoSuite.

the class MockJOptionPaneShowInputDialogTest method testShowOptionDialog.

@Test
public void testShowOptionDialog() throws Exception {
    TestSuiteChromosome suite = new TestSuiteChromosome();
    InstrumentingClassLoader cl = new InstrumentingClassLoader();
    TestCase t1 = buildTestCase0(cl);
    suite.addTest(t1);
    BranchCoverageSuiteFitness ff = new BranchCoverageSuiteFitness(cl);
    ff.getFitness(suite);
    Set<TestFitnessFunction> coveredGoals = suite.getCoveredGoals();
    Assert.assertEquals(7, coveredGoals.size());
}
Also used : TestCase(org.evosuite.testcase.TestCase) TestFitnessFunction(org.evosuite.testcase.TestFitnessFunction) BranchCoverageSuiteFitness(org.evosuite.coverage.branch.BranchCoverageSuiteFitness) TestSuiteChromosome(org.evosuite.testsuite.TestSuiteChromosome) InstrumentingClassLoader(org.evosuite.instrumentation.InstrumentingClassLoader) Test(org.junit.Test)

Example 27 with BranchCoverageSuiteFitness

use of org.evosuite.coverage.branch.BranchCoverageSuiteFitness in project evosuite by EvoSuite.

the class MockJOptionPaneShowInternalInputDialogTest method testShowInternalInputDialog.

@Test
public void testShowInternalInputDialog() throws Exception {
    TestSuiteChromosome suite = new TestSuiteChromosome();
    InstrumentingClassLoader cl = new InstrumentingClassLoader();
    TestCase t1 = buildTestCase0(cl);
    suite.addTest(t1);
    BranchCoverageSuiteFitness ff = new BranchCoverageSuiteFitness(cl);
    ff.getFitness(suite);
    Set<TestFitnessFunction> coveredGoals = suite.getCoveredGoals();
    Assert.assertEquals(4, coveredGoals.size());
}
Also used : TestCase(org.evosuite.testcase.TestCase) TestFitnessFunction(org.evosuite.testcase.TestFitnessFunction) BranchCoverageSuiteFitness(org.evosuite.coverage.branch.BranchCoverageSuiteFitness) TestSuiteChromosome(org.evosuite.testsuite.TestSuiteChromosome) InstrumentingClassLoader(org.evosuite.instrumentation.InstrumentingClassLoader) Test(org.junit.Test)

Example 28 with BranchCoverageSuiteFitness

use of org.evosuite.coverage.branch.BranchCoverageSuiteFitness in project evosuite by EvoSuite.

the class MockJOptionPaneShowConfirmDialogTest method testShowConfirmDialogs.

@Test
public void testShowConfirmDialogs() throws Exception {
    TestSuiteChromosome suite = new TestSuiteChromosome();
    InstrumentingClassLoader cl = new InstrumentingClassLoader();
    TestCase t1 = buildTestCase0(cl);
    suite.addTest(t1);
    BranchCoverageSuiteFitness ff = new BranchCoverageSuiteFitness(cl);
    ff.getFitness(suite);
    Set<TestFitnessFunction> coveredGoals = suite.getCoveredGoals();
    Assert.assertEquals(5, coveredGoals.size());
}
Also used : TestCase(org.evosuite.testcase.TestCase) TestFitnessFunction(org.evosuite.testcase.TestFitnessFunction) BranchCoverageSuiteFitness(org.evosuite.coverage.branch.BranchCoverageSuiteFitness) TestSuiteChromosome(org.evosuite.testsuite.TestSuiteChromosome) InstrumentingClassLoader(org.evosuite.instrumentation.InstrumentingClassLoader) Test(org.junit.Test)

Example 29 with BranchCoverageSuiteFitness

use of org.evosuite.coverage.branch.BranchCoverageSuiteFitness in project evosuite by EvoSuite.

the class MockJOptionPaneShowInternalConfirmDialogTest method testShowInternalConfirmDialog.

@Test
public void testShowInternalConfirmDialog() throws Exception {
    TestSuiteChromosome suite = new TestSuiteChromosome();
    InstrumentingClassLoader cl = new InstrumentingClassLoader();
    TestCase t0 = buildTestCase0(cl);
    TestCase t1 = buildTestCase1(cl);
    suite.addTest(t0);
    suite.addTest(t1);
    BranchCoverageSuiteFitness ff = new BranchCoverageSuiteFitness(cl);
    ff.getFitness(suite);
    Set<TestFitnessFunction> coveredGoals = suite.getCoveredGoals();
    Assert.assertEquals(3, coveredGoals.size());
}
Also used : TestCase(org.evosuite.testcase.TestCase) TestFitnessFunction(org.evosuite.testcase.TestFitnessFunction) BranchCoverageSuiteFitness(org.evosuite.coverage.branch.BranchCoverageSuiteFitness) TestSuiteChromosome(org.evosuite.testsuite.TestSuiteChromosome) InstrumentingClassLoader(org.evosuite.instrumentation.InstrumentingClassLoader) Test(org.junit.Test)

Example 30 with BranchCoverageSuiteFitness

use of org.evosuite.coverage.branch.BranchCoverageSuiteFitness in project evosuite by EvoSuite.

the class MockJOptionPaneShowInternalMessageDialogTest method testShowInternalMessageDialog.

@Test
public void testShowInternalMessageDialog() throws Exception {
    TestSuiteChromosome suite = new TestSuiteChromosome();
    InstrumentingClassLoader cl = new InstrumentingClassLoader();
    TestCase t0 = buildTestCase0(cl);
    TestCase t1 = buildTestCase1(cl);
    suite.addTest(t0);
    suite.addTest(t1);
    BranchCoverageSuiteFitness ff = new BranchCoverageSuiteFitness(cl);
    ff.getFitness(suite);
    Set<TestFitnessFunction> coveredGoals = suite.getCoveredGoals();
    Assert.assertEquals(3, coveredGoals.size());
}
Also used : TestCase(org.evosuite.testcase.TestCase) TestFitnessFunction(org.evosuite.testcase.TestFitnessFunction) BranchCoverageSuiteFitness(org.evosuite.coverage.branch.BranchCoverageSuiteFitness) TestSuiteChromosome(org.evosuite.testsuite.TestSuiteChromosome) InstrumentingClassLoader(org.evosuite.instrumentation.InstrumentingClassLoader) Test(org.junit.Test)

Aggregations

BranchCoverageSuiteFitness (org.evosuite.coverage.branch.BranchCoverageSuiteFitness)52 Test (org.junit.Test)45 TestSuiteChromosome (org.evosuite.testsuite.TestSuiteChromosome)44 DefaultTestCase (org.evosuite.testcase.DefaultTestCase)18 TestCase (org.evosuite.testcase.TestCase)17 DefaultLocalSearchObjective (org.evosuite.ga.localsearch.DefaultLocalSearchObjective)16 TestChromosome (org.evosuite.testcase.TestChromosome)14 Properties (org.evosuite.Properties)12 InstrumentingClassLoader (org.evosuite.instrumentation.InstrumentingClassLoader)12 TestFitnessFunction (org.evosuite.testcase.TestFitnessFunction)12 Method (java.lang.reflect.Method)11 GenericMethod (org.evosuite.utils.generic.GenericMethod)11 IntPrimitiveStatement (org.evosuite.testcase.statements.numeric.IntPrimitiveStatement)10 ArrayList (java.util.ArrayList)8 BranchCoverageFactory (org.evosuite.coverage.branch.BranchCoverageFactory)7 ConstructorStatement (org.evosuite.testcase.statements.ConstructorStatement)7 VariableReference (org.evosuite.testcase.variable.VariableReference)7 GenericClass (org.evosuite.utils.generic.GenericClass)7 GenericConstructor (org.evosuite.utils.generic.GenericConstructor)7 Foo (com.examples.with.different.packagename.symbolic.Foo)6