use of de.dagere.peass.dependency.analysis.data.TestCase in project peass by DaGeRe.
the class TestCoverageBasedSelection method testSelectionBasedOnParameterizedChange.
@Test
public void testSelectionBasedOnParameterizedChange() {
List<TraceCallSummary> traces = getTraceSummaryList();
Set<ChangedEntity> changes = new HashSet<>();
ChangedEntity entityWithIntParameter = new ChangedEntity("de.dagere.peass.ExampleClazz", "", "method2");
entityWithIntParameter.getParameters().add("int");
changes.add(entityWithIntParameter);
Set<TestCase> selected = CoverageBasedSelector.selectBasedOnCoverage(traces, changes).getTestcases().keySet();
MatcherAssert.assertThat(selected, IsIterableContaining.hasItem(new TestCase("ClazzA#testA")));
}
use of de.dagere.peass.dependency.analysis.data.TestCase in project peass by DaGeRe.
the class TestCoverageBasedSelection method getTraceSummaryList.
private List<TraceCallSummary> getTraceSummaryList() {
List<Content> firstTrace = TestTraceSummaryTransformer.buildTestTrace();
TraceCallSummary summary = TraceSummaryTransformer.transform(new TestCase("ClazzA#testA"), firstTrace);
List<Content> secondTrace = TestTraceSummaryTransformer.buildOtherTrace();
TraceCallSummary summary2 = TraceSummaryTransformer.transform(new TestCase("ClazzB#testB"), secondTrace);
List<Content> betterTrace = TestTraceSummaryTransformer.buildBetterMatchingOtherTrace();
TraceCallSummary summary3 = TraceSummaryTransformer.transform(new TestCase("ClazzC#testC"), betterTrace);
List<TraceCallSummary> traces = Arrays.asList(summary, summary2, summary3);
return traces;
}
use of de.dagere.peass.dependency.analysis.data.TestCase in project peass by DaGeRe.
the class CoverageBasedSelectionIT method testNormalChange.
@Test
public void testNormalChange() throws IOException, InterruptedException, XmlPullParserException, ParseException, ViewNotFoundException {
try (MockedStatic<GitUtils> staticMock = Mockito.mockStatic(GitUtils.class)) {
final ChangeManager changeManager = DependencyDetectorTestUtil.defaultChangeManager();
final VersionIterator fakeIterator = new FakeFileIterator(DependencyTestConstants.CURRENT, Arrays.asList(DependencyTestConstants.COVERAGE_NORMAL_CHANGE));
final DependencyReader reader = DependencyDetectorTestUtil.readTwoVersions(changeManager, fakeIterator, new ExecutionConfig(5), DependencyTestConstants.DEFAULT_CONFIG_WITH_COVERAGE, DependencyTestConstants.TARGET_RESULTS_FOLDERS);
System.out.println(reader.getDependencies());
DependencyDetectorTestUtil.checkChange(reader, "defaultpackage.NormalDependency#executeThing", "defaultpackage.TestMe", DependencyTestConstants.VERSION_1, "testFirst");
System.out.println(reader.getCoverageBasedSelection());
TestSet tests = reader.getCoverageBasedSelection().getVersions().get(DependencyTestConstants.VERSION_1);
MatcherAssert.assertThat(tests.getTests(), IsIterableContaining.hasItem(new TestCase("defaultpackage.TestMe#testSecond")));
}
}
use of de.dagere.peass.dependency.analysis.data.TestCase in project peass by DaGeRe.
the class TestNonIncludedTestRemover method testWithSetOnlyExclude.
@Test
public void testWithSetOnlyExclude() {
Set<TestCase> tests = new HashSet<TestCase>();
tests.add(new TestCase("TestA", "method1"));
tests.add(new TestCase("TestA", "method2"));
tests.add(new TestCase("TestB", "method3"));
tests.add(new TestCase("TestC", null));
tests.add(new TestCase("TestD", null));
ExecutionConfig executionConfig = new ExecutionConfig(Arrays.asList(new String[] {}), "test");
executionConfig.setExcludes(Arrays.asList(new String[] { "TestA#*" }));
NonIncludedTestRemover.removeNotIncluded(tests, executionConfig);
Assert.assertEquals(3, tests.size());
}
use of de.dagere.peass.dependency.analysis.data.TestCase in project peass by DaGeRe.
the class TestNonIncludedTestRemover method testWithTestSet.
@Test
public void testWithTestSet() {
TestSet tests = new TestSet();
tests.addTest(new TestCase("TestA", "method1"));
tests.addTest(new TestCase("TestA", "method2"));
tests.addTest(new TestCase("TestB", "method3"));
tests.addTest(new TestCase("TestC", null));
tests.addTest(new TestCase("TestD", null));
NonIncludedTestRemover.removeNotIncluded(tests, new ExecutionConfig(Arrays.asList(new String[] { "TestA#method1", "TestC" }), "test"));
Assert.assertEquals(2, tests.getTests().size());
}
Aggregations