use of fr.inria.diversify.dspot.selector.JacocoCoverageSelector 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());
}
use of fr.inria.diversify.dspot.selector.JacocoCoverageSelector in project dspot by STAMP-project.
the class DSpotTest method testExcludedClassesInPropertyFile.
@Test
public void testExcludedClassesInPropertyFile() throws Exception {
/*
Usage of properties:
- excludedClasses: list of full qualified name of test classes to be excluded (separated by comma ',')
- excludedTestCases: list of name of test cases (methods) to be excluded (separated by comma ',')
*/
final MockDSpot dSpot = new MockDSpot(Utils.getInputConfiguration(), 1, Collections.singletonList(new TestMethodCallAdder()), new JacocoCoverageSelector());
// the test class fr.inria.filter.passing.PassingTest has 2 method, but only one is amplified
assertEquals(2, Utils.findClass("fr.inria.filter.passing.PassingTest").getMethods().size());
// the test class fr.inria.filter.failing.FailingTest match the regex, but it is excluded in the properties
final List<CtType> ctTypes = dSpot.amplifyTest("fr.inria.filter.*");
assertEquals(1, ctTypes.size());
// uses the mock to retrieve the number of method to be amplified
assertEquals(1, dSpot.numberOfMethod);
}
use of fr.inria.diversify.dspot.selector.JacocoCoverageSelector in project dspot by STAMP-project.
the class ProjectJSONTest method test.
@Test
public void test() throws Exception {
final File file = new File("target/trash/sample.json");
if (file.exists()) {
file.delete();
}
DSpot dspot = new DSpot(new InputConfiguration("src/test/resources/sample/sample.properties"), 1, Collections.singletonList(new TestDataMutator()), new JacocoCoverageSelector());
dspot.amplifyTest("fr.inria.amp.TestJavaPoet");
try (BufferedReader buffer = new BufferedReader(new FileReader(file))) {
final String jsonAsString = buffer.lines().collect(Collectors.joining(AmplificationHelper.LINE_SEPARATOR));
assertTrue(jsonAsString.startsWith(expectedFirstProjectJSON[0]));
assertTrue(jsonAsString.endsWith(expectedFirstProjectJSON[1]));
}
dspot.amplifyTest("fr.inria.mutation.ClassUnderTestTest");
try (BufferedReader buffer = new BufferedReader(new FileReader(file))) {
final String jsonAsString = buffer.lines().collect(Collectors.joining(AmplificationHelper.LINE_SEPARATOR));
assertTrue(jsonAsString.startsWith(expectedFirstProjectJSON[0]));
assertTrue(jsonAsString.contains(expectedFirstProjectJSON[2]));
assertTrue(jsonAsString.endsWith(expectedFirstProjectJSON[3]));
}
dspot.amplifyTest("fr.inria.amp.TestJavaPoet");
try (BufferedReader buffer = new BufferedReader(new FileReader(file))) {
final String jsonAsString = buffer.lines().collect(Collectors.joining(AmplificationHelper.LINE_SEPARATOR));
assertTrue(jsonAsString.startsWith(expectedFirstProjectJSON[0]));
assertTrue(jsonAsString.endsWith(expectedFirstProjectJSON[1]));
}
}
use of fr.inria.diversify.dspot.selector.JacocoCoverageSelector in project dspot by STAMP-project.
the class Main method runExample.
static void runExample() {
try {
InputConfiguration configuration = new InputConfiguration("src/test/resources/test-projects/test-projects.properties");
DSpot dSpot = new DSpot(configuration, 1, Collections.singletonList(new TestDataMutator()), new JacocoCoverageSelector());
dSpot.amplifyTest("example.TestSuiteExample");
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of fr.inria.diversify.dspot.selector.JacocoCoverageSelector 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;
}
Aggregations