use of de.dagere.peass.dependency.analysis.data.ChangeTestMapping in project peass by DaGeRe.
the class TestTestDependencies method testParameterChange.
private void testParameterChange(final TestDependencies dependencies, final String parameterizedMethod) {
HashMap<ChangedEntity, ClazzChangeData> changeTestMap = new HashMap<ChangedEntity, ClazzChangeData>();
ClazzChangeData classChangeData = new ClazzChangeData(new ChangedEntity("package.ClazzB", "moduleA"), true);
classChangeData.addChange("ClazzB", parameterizedMethod);
changeTestMap.put(new ChangedEntity("package.ClazzB", "moduleA"), classChangeData);
ChangeTestMapping changes = dependencies.getChangeTestMap(changeTestMap);
Assert.assertEquals(1, changes.getChanges().size());
}
use of de.dagere.peass.dependency.analysis.data.ChangeTestMapping in project peass by DaGeRe.
the class StaticChangeHandler method handleStaticAnalysisChanges.
public VersionStaticSelection handleStaticAnalysisChanges(final String version, final DependencyReadingInput input) throws IOException, JsonGenerationException, JsonMappingException {
// tells which tests need to be run, and
final ChangeTestMapping changeTestMap = dependencyManager.getDependencyMap().getChangeTestMap(input.getChanges());
// because of which change they need to be run
LOG.debug("Change test mapping (without added tests): " + changeTestMap);
handleAddedTests(input, changeTestMap);
if (executionConfig.isCreateDetailDebugFiles())
Constants.OBJECTMAPPER.writeValue(new File(folders.getDebugFolder(), "changeTestMap_" + version + ".json"), changeTestMap);
final VersionStaticSelection newVersionStaticSelection = DependencyReaderUtil.createVersionFromChangeMap(input.getChanges(), changeTestMap);
newVersionStaticSelection.setJdk(dependencyManager.getExecutor().getJDKVersion());
newVersionStaticSelection.setPredecessor(input.getPredecessor());
if (executionConfig.isCreateDetailDebugFiles()) {
Constants.OBJECTMAPPER.writeValue(new File(folders.getDebugFolder(), "versionStaticSelection_" + version + ".json"), newVersionStaticSelection);
}
return newVersionStaticSelection;
}
use of de.dagere.peass.dependency.analysis.data.ChangeTestMapping in project peass by DaGeRe.
the class TestTestDependencies method testNonParameterChange.
private void testNonParameterChange(final TestDependencies dependencies) {
HashMap<ChangedEntity, ClazzChangeData> changeTestMap = new HashMap<ChangedEntity, ClazzChangeData>();
ClazzChangeData classChangeData = new ClazzChangeData(new ChangedEntity("package.ClazzB", "moduleA"), true);
classChangeData.addChange("ClazzB", "methodB");
changeTestMap.put(new ChangedEntity("package.ClazzB", "moduleA"), classChangeData);
ChangeTestMapping changes = dependencies.getChangeTestMap(changeTestMap);
Assert.assertEquals(1, changes.getChanges().size());
}
use of de.dagere.peass.dependency.analysis.data.ChangeTestMapping in project peass by DaGeRe.
the class TestTestDependencies method testClassLevelChange.
@Test
public void testClassLevelChange() {
TestDependencies dependencies = buildTestDependencies();
HashMap<ChangedEntity, ClazzChangeData> changes = new HashMap<ChangedEntity, ClazzChangeData>();
ClazzChangeData clazzChangeData = new ClazzChangeData(new ChangedEntity("package.ClazzA", "moduleA"), false);
clazzChangeData.addChange("ClazzA", "methodB");
changes.put(new ChangedEntity("package.ClazzA", "moduleA"), clazzChangeData);
ChangeTestMapping changeTestMap = dependencies.getChangeTestMap(changes);
Set<ChangedEntity> changedClazzes = changeTestMap.getChanges().keySet();
MatcherAssert.assertThat(changedClazzes, IsIterableContaining.hasItem(new ChangedEntity("package.ClazzA", "moduleA", "methodB")));
MatcherAssert.assertThat(changeTestMap.getChanges().get(new ChangedEntity("package.ClazzA", "moduleA", "methodB")), IsIterableContaining.hasItem(testEntity));
MatcherAssert.assertThat(changeTestMap.getChanges().get(new ChangedEntity("package.ClazzA", "moduleA")), IsIterableContaining.hasItem(testEntity));
}
Aggregations