Search in sources :

Example 1 with PitMutantScoreSelector

use of fr.inria.diversify.dspot.selector.PitMutantScoreSelector in project dspot by STAMP-project.

the class JSAPOptions method parse.

public static Configuration parse(String[] args) {
    JSAPResult jsapConfig = options.parse(args);
    Main.verbose = jsapConfig.getBoolean("verbose");
    if (!jsapConfig.success() || jsapConfig.getBoolean("help")) {
        System.err.println();
        for (Iterator<?> errs = jsapConfig.getErrorMessageIterator(); errs.hasNext(); ) {
            System.err.println("Error: " + errs.next());
        }
        showUsage();
    } else if (jsapConfig.getBoolean("example")) {
        return null;
    }
    if (jsapConfig.getString("path") == null) {
        System.err.println("Error: Parameter 'path' is required.");
        showUsage();
    }
    TestSelector testCriterion;
    if (jsapConfig.getString("mutant") != null) {
        if (!"PitMutantScoreSelector".equals(jsapConfig.getString("test-criterion"))) {
            LOGGER.warn("You specify a path to mutations.csv but you did not specified the right test-criterion");
            LOGGER.warn("Forcing the Selector to PitMutantScoreSelector");
        }
        testCriterion = new PitMutantScoreSelector(jsapConfig.getString("mutant"));
    } else {
        testCriterion = SelectorEnum.valueOf(jsapConfig.getString("test-criterion")).buildSelector();
    }
    PitMutantScoreSelector.descartesMode = jsapConfig.getBoolean("descartes");
    TestRunnerFactory.useReflectiveTestRunner = false;
    DSpotUtils.withComment = jsapConfig.getBoolean("comment");
    return new Configuration(jsapConfig.getString("path"), buildAmplifiersFromString(jsapConfig.getStringArray("amplifiers")), jsapConfig.getInt("iteration"), Arrays.asList(jsapConfig.getStringArray("test")), jsapConfig.getString("output"), testCriterion, Arrays.asList(jsapConfig.getStringArray("testCases")), jsapConfig.getLong("seed"), jsapConfig.getInt("timeOut"), jsapConfig.getString("builder"), jsapConfig.getString("mavenHome"), jsapConfig.getInt("maxTestAmplified"), jsapConfig.getBoolean("clean"), !jsapConfig.getBoolean("no-minimize"));
}
Also used : PitMutantScoreSelector(fr.inria.diversify.dspot.selector.PitMutantScoreSelector) TestSelector(fr.inria.diversify.dspot.selector.TestSelector)

Example 2 with PitMutantScoreSelector

use of fr.inria.diversify.dspot.selector.PitMutantScoreSelector 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)

Aggregations

PitMutantScoreSelector (fr.inria.diversify.dspot.selector.PitMutantScoreSelector)2 DSpot (fr.inria.diversify.dspot.DSpot)1 NumberLiteralAmplifier (fr.inria.diversify.dspot.amplifier.NumberLiteralAmplifier)1 StringLiteralAmplifier (fr.inria.diversify.dspot.amplifier.StringLiteralAmplifier)1 TestSelector (fr.inria.diversify.dspot.selector.TestSelector)1 InputConfiguration (fr.inria.diversify.utils.sosiefier.InputConfiguration)1 Test (org.junit.Test)1