Search in sources :

Example 6 with InputConfiguration

use of fr.inria.diversify.utils.sosiefier.InputConfiguration in project dspot by STAMP-project.

the class GradleAutomaticBuilderTest method setUp.

@Before
public void setUp() throws Exception {
    cleanTestEnv();
    Utils.init("src/test/resources/test-projects/test-projects.properties");
    AutomaticBuilderFactory.reset();
    Utils.LOGGER.debug("Test Set-up - Reading input parameters...");
    this.configuration = JSAPOptions.parse(getArgsWithGradleBuilder());
    InputConfiguration inputConfiguration = Utils.getInputConfiguration();
    inputConfiguration.getProperties().setProperty("automaticBuilderName", this.configuration.automaticBuilderName);
    Utils.LOGGER.debug("Test Set-up - instantiating Automatic Builder (SUT)...");
    sut = AutomaticBuilderFactory.getAutomaticBuilder(inputConfiguration);
    Utils.LOGGER.debug("Test Set-up complete.");
}
Also used : InputConfiguration(fr.inria.diversify.utils.sosiefier.InputConfiguration) Before(org.junit.Before)

Example 7 with InputConfiguration

use of fr.inria.diversify.utils.sosiefier.InputConfiguration in project dspot by STAMP-project.

the class GradleAutomaticBuilderWithDescartesTest method setUp.

@Before
public void setUp() throws Exception {
    cleanTestEnv();
    Utils.init("src/test/resources/test-projects/test-projects.properties");
    AutomaticBuilderFactory.reset();
    Utils.LOGGER.debug("Test Set-up - Reading input parameters...");
    this.configuration = JSAPOptions.parse(getArgsWithGradleBuilder());
    InputConfiguration inputConfiguration = Utils.getInputConfiguration();
    inputConfiguration.getProperties().setProperty("automaticBuilderName", this.configuration.automaticBuilderName);
    Utils.LOGGER.debug("Test Set-up - instantiating Automatic Builder (SUT)...");
    sut = AutomaticBuilderFactory.getAutomaticBuilder(inputConfiguration);
    Utils.LOGGER.debug("Test Set-up complete.");
}
Also used : InputConfiguration(fr.inria.diversify.utils.sosiefier.InputConfiguration) Before(org.junit.Before)

Example 8 with InputConfiguration

use of fr.inria.diversify.utils.sosiefier.InputConfiguration in project dspot by STAMP-project.

the class JacocoCoverageSelectorTest method testDSpotWithJacocoCoverageSelector.

@Test
public void testDSpotWithJacocoCoverageSelector() throws Exception {
    try {
        FileUtils.deleteDirectory(new File("target/trash"));
    } catch (Exception ignored) {
    // ignored
    }
    AmplificationHelper.setSeedRandom(23L);
    InputConfiguration configuration = new InputConfiguration("src/test/resources/test-projects/test-projects.properties");
    DSpot dspot = new DSpot(configuration, 2, Arrays.asList(new TestDataMutator(), new StatementAdd()), new JacocoCoverageSelector());
    dspot.amplifyTest("example.TestSuiteExample", Collections.singletonList("test2"));
    try (BufferedReader buffer = new BufferedReader(new FileReader(configuration.getOutputDirectory() + "example.TestSuiteExample_jacoco_instr_coverage_report.txt"))) {
        assertEquals(expectedReport, buffer.lines().collect(Collectors.joining(nl)));
    }
}
Also used : DSpot(fr.inria.diversify.dspot.DSpot) BufferedReader(java.io.BufferedReader) StatementAdd(fr.inria.diversify.dspot.amplifier.StatementAdd) FileReader(java.io.FileReader) File(java.io.File) InputConfiguration(fr.inria.diversify.utils.sosiefier.InputConfiguration) TestDataMutator(fr.inria.diversify.dspot.amplifier.TestDataMutator) Test(org.junit.Test)

Example 9 with InputConfiguration

use of fr.inria.diversify.utils.sosiefier.InputConfiguration in project dspot by STAMP-project.

the class DSpotMockedTest method test.

@Test
public void test() throws Exception {
    /*
			Test the whole dspot procedure.
         */
    ValueCreator.count = 0;
    AmplificationHelper.setSeedRandom(23L);
    InputConfiguration configuration = new InputConfiguration(getPathToPropertiesFile());
    InputProgram program = new InputProgram();
    configuration.setInputProgram(program);
    DSpot dspot = new DSpot(configuration, 1, Arrays.asList(new StatementAdd()));
    try {
        FileUtils.cleanDirectory(new File(configuration.getOutputDirectory()));
    } catch (Exception ignored) {
    }
    assertEquals(6, dspot.getInputProgram().getFactory().Class().get("info.sanaulla.dal.BookDALTest").getMethods().size());
    CtType<?> amplifiedTest = dspot.amplifyTest("info.sanaulla.dal.BookDALTest", Collections.singletonList("testGetBook"));
    assertEquals(1, amplifiedTest.getMethods().stream().filter(AmplificationChecker::isTest).count());
    System.out.println(amplifiedTest);
    assertTrue(!amplifiedTest.getMethodsByName("testGetBook_sd8").isEmpty());
}
Also used : AmplificationChecker(fr.inria.diversify.utils.AmplificationChecker) StatementAdd(fr.inria.diversify.dspot.amplifier.StatementAdd) InputConfiguration(fr.inria.diversify.utils.sosiefier.InputConfiguration) File(java.io.File) InputProgram(fr.inria.diversify.utils.sosiefier.InputProgram) Test(org.junit.Test) AbstractTest(fr.inria.AbstractTest)

Example 10 with InputConfiguration

use of fr.inria.diversify.utils.sosiefier.InputConfiguration in project dspot by STAMP-project.

the class DSpotSelectionTest method setUpClass.

@BeforeClass
public static void setUpClass() throws Exception {
    Utils.reset();
    final InputConfiguration inputConfiguration = new InputConfiguration("src/test/resources/test-projects/test-projects.properties");
    Main.createOutputDirectories(inputConfiguration, true);
    dspotUnderTest = new MockedDSpot(inputConfiguration, 1, new JacocoCoverageSelector());
}
Also used : JacocoCoverageSelector(fr.inria.diversify.dspot.selector.JacocoCoverageSelector) InputConfiguration(fr.inria.diversify.utils.sosiefier.InputConfiguration) BeforeClass(org.junit.BeforeClass)

Aggregations

InputConfiguration (fr.inria.diversify.utils.sosiefier.InputConfiguration)25 Test (org.junit.Test)14 InputProgram (fr.inria.diversify.utils.sosiefier.InputProgram)11 JacocoCoverageSelector (fr.inria.diversify.dspot.selector.JacocoCoverageSelector)6 File (java.io.File)6 TestDataMutator (fr.inria.diversify.dspot.amplifier.TestDataMutator)5 DSpot (fr.inria.diversify.dspot.DSpot)4 AbstractTest (fr.inria.AbstractTest)3 IOException (java.io.IOException)3 Launcher (spoon.Launcher)3 CtType (spoon.reflect.declaration.CtType)3 StatementAdd (fr.inria.diversify.dspot.amplifier.StatementAdd)2 TestListener (fr.inria.stamp.test.listener.TestListener)2 BufferedReader (java.io.BufferedReader)2 FileReader (java.io.FileReader)2 Before (org.junit.Before)2 AutomaticBuilder (fr.inria.diversify.automaticbuilder.AutomaticBuilder)1 AutomaticBuilderFactory (fr.inria.diversify.automaticbuilder.AutomaticBuilderFactory)1 NumberLiteralAmplifier (fr.inria.diversify.dspot.amplifier.NumberLiteralAmplifier)1 StringLiteralAmplifier (fr.inria.diversify.dspot.amplifier.StringLiteralAmplifier)1