Search in sources :

Example 21 with InputConfiguration

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

the class AutomaticBuilderFactoryTest method getAutomaticBuilder_whenUnknown.

@Test
public void getAutomaticBuilder_whenUnknown() throws Exception {
    this.configuration = JSAPOptions.parse(getArgsWithUnknownBuilder());
    InputConfiguration inputConfiguration = new InputConfiguration(configuration.pathToConfigurationFile);
    inputConfiguration.getProperties().setProperty("automaticBuilderName", configuration.automaticBuilderName);
    InputProgram program = InputConfiguration.initInputProgram(inputConfiguration);
    inputConfiguration.setInputProgram(program);
    assertFalse(inputConfiguration.getProperty("automaticBuilderName") == null);
    assertFalse(inputConfiguration.getProperty("automaticBuilderName").toUpperCase().contains("MAVEN"));
    assertFalse(inputConfiguration.getProperty("automaticBuilderName").toUpperCase().contains("GRADLE"));
    AutomaticBuilder builder = AutomaticBuilderFactory.getAutomaticBuilder(inputConfiguration);
    assertNotNull(builder);
    assertTrue(builder.getClass().equals(MavenAutomaticBuilder.class));
}
Also used : InputConfiguration(fr.inria.diversify.utils.sosiefier.InputConfiguration) InputProgram(fr.inria.diversify.utils.sosiefier.InputProgram) Test(org.junit.Test)

Example 22 with InputConfiguration

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

the class AutomaticBuilderFactoryTest method getAutomaticBuilder_whenGradle.

@Test
public void getAutomaticBuilder_whenGradle() throws Exception {
    this.configuration = JSAPOptions.parse(getArgsWithGradleBuilder());
    InputConfiguration inputConfiguration = new InputConfiguration(configuration.pathToConfigurationFile);
    inputConfiguration.getProperties().setProperty("automaticBuilderName", configuration.automaticBuilderName);
    assertTrue(inputConfiguration.getProperty("automaticBuilderName").toUpperCase().contains("GRADLE"));
    AutomaticBuilder builder = AutomaticBuilderFactory.getAutomaticBuilder(inputConfiguration);
    assertNotNull(builder);
    assertTrue(builder.getClass().equals(GradleAutomaticBuilder.class));
}
Also used : InputConfiguration(fr.inria.diversify.utils.sosiefier.InputConfiguration) Test(org.junit.Test)

Example 23 with InputConfiguration

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

the class PitScoreMutantSelectorDescartesTest method testPitDescartesMode.

@Test
public void testPitDescartesMode() throws Exception {
    /*
            weak contract: this test should not throw any exception and end properly
                the increase of the mutation score and the selection is delegated to dedicated test
                here we test that the descartes mode runs
         */
    assertFalse(PitMutantScoreSelector.descartesMode);
    PitMutantScoreSelector.descartesMode = true;
    PitMutantScoreSelector.pitVersion = "1.2.0";
    InputConfiguration configuration = new InputConfiguration("src/test/resources/test-projects/test-projects.properties");
    DSpot dspot = new DSpot(configuration, 1, Arrays.asList(new StringLiteralAmplifier(), new NumberLiteralAmplifier()), new PitMutantScoreSelector());
    dspot.amplifyTest("example.TestSuiteExample", Collections.singletonList("test2"));
    FileUtils.cleanDirectory(new File(configuration.getOutputDirectory()));
    assertTrue(PitMutantScoreSelector.descartesMode);
}
Also used : DSpot(fr.inria.diversify.dspot.DSpot) PitMutantScoreSelector(fr.inria.diversify.dspot.selector.PitMutantScoreSelector) StringLiteralAmplifier(fr.inria.diversify.dspot.amplifier.StringLiteralAmplifier) InputConfiguration(fr.inria.diversify.utils.sosiefier.InputConfiguration) NumberLiteralAmplifier(fr.inria.diversify.dspot.amplifier.NumberLiteralAmplifier) Test(org.junit.Test)

Example 24 with InputConfiguration

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

the class DSpotMultiplePomTest method testCopyMultipleModuleProject.

@Test
public void testCopyMultipleModuleProject() throws Exception {
    /*
            Contract: DSpot is able to amplify a multi-module project
         */
    Main.verbose = true;
    EntryPoint.verbose = true;
    final InputConfiguration configuration = new InputConfiguration("src/test/resources/multiple-pom/deep-pom-modules.properties");
    final DSpot dspot = new DSpot(configuration, new JacocoCoverageSelector());
    final List<CtType> ctTypes = dspot.amplifyAllTests();
    assertFalse(ctTypes.isEmpty());
    EntryPoint.verbose = false;
    Main.verbose = false;
}
Also used : CtType(spoon.reflect.declaration.CtType) JacocoCoverageSelector(fr.inria.diversify.dspot.selector.JacocoCoverageSelector) InputConfiguration(fr.inria.diversify.utils.sosiefier.InputConfiguration) Test(org.junit.Test)

Example 25 with InputConfiguration

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

the class DSpotTest method testInheritanceMethod.

@Test
public void testInheritanceMethod() throws Exception {
    /*
            Test that DSpot can be run on an abstract test, using its implementation.
         */
    final InputConfiguration configuration = new InputConfiguration("src/test/resources/sample/sample.properties");
    DSpot dspot = new DSpot(configuration, 3, Collections.singletonList(new TestDataMutator()), new JacocoCoverageSelector());
    CtType<?> ctType = dspot.amplifyTest("fr.inria.inheritance.Inherited").get(0);
    assertEquals(1, ctType.getMethods().size());
}
Also used : JacocoCoverageSelector(fr.inria.diversify.dspot.selector.JacocoCoverageSelector) InputConfiguration(fr.inria.diversify.utils.sosiefier.InputConfiguration) TestDataMutator(fr.inria.diversify.dspot.amplifier.TestDataMutator) Test(org.junit.Test) AbstractTest(fr.inria.AbstractTest)

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