use of de.dagere.peass.dependency.analysis.data.TestSet in project peass by DaGeRe.
the class TestBenchmarkChangeDetection method testBenchmarkDetection.
@Test
public void testBenchmarkDetection() throws FileNotFoundException, IOException, XmlPullParserException {
JmhTestTransformer jmhTransformer = new JmhTestTransformer(JmhTestConstants.BASIC_VERSION, TestBenchmarkDetection.JMH_CONFIG);
TestSet originalTests = new TestSet(new TestCase("de.dagere.peass.ExampleBenchmark", (String) null, ""));
TestSet changedTests = jmhTransformer.buildTestMethodSet(originalTests, Arrays.asList(new File[] { JmhTestConstants.BASIC_VERSION }));
Assert.assertEquals(changedTests.getTests().size(), 1);
TestCase test = changedTests.getTests().iterator().next();
Assert.assertEquals("de.dagere.peass.ExampleBenchmark#testMethod", test.getExecutable());
}
use of de.dagere.peass.dependency.analysis.data.TestSet in project peass by DaGeRe.
the class TestBenchmarkDetection method testBenchmarkDetection.
@Test
public void testBenchmarkDetection() throws FileNotFoundException, IOException, XmlPullParserException {
JmhTestTransformer jmhTransformer = new JmhTestTransformer(JmhTestConstants.BASIC_VERSION, JMH_CONFIG);
ProjectModules modules = new ProjectModules(JmhTestConstants.BASIC_VERSION);
TestSet tests = jmhTransformer.findModuleTests(new ModuleClassMapping(JmhTestConstants.BASIC_VERSION, modules, new ExecutionConfig()), null, modules);
Assert.assertEquals(tests.getTests().size(), 1);
TestCase test = tests.getTests().iterator().next();
Assert.assertEquals("de.dagere.peass.ExampleBenchmark#testMethod", test.getExecutable());
}
use of de.dagere.peass.dependency.analysis.data.TestSet in project peass by DaGeRe.
the class TestBenchmarkDetection method testMultimoduleBenchmarkDetection.
@Test
public void testMultimoduleBenchmarkDetection() throws FileNotFoundException, IOException, XmlPullParserException {
JmhTestTransformer jmhTransformer = new JmhTestTransformer(JmhTestConstants.MULTIMODULE_VERSION, JMH_CONFIG);
ProjectModules modules = new ProjectModules(Arrays.asList(new File[] { new File(JmhTestConstants.MULTIMODULE_VERSION, "base-module"), new File(JmhTestConstants.MULTIMODULE_VERSION, "using-module") }));
ModuleClassMapping mapping = new ModuleClassMapping(JmhTestConstants.MULTIMODULE_VERSION, modules, new ExecutionConfig());
TestSet tests = jmhTransformer.findModuleTests(mapping, null, modules);
Iterator<TestCase> iterator = tests.getTests().iterator();
TestCase test = iterator.next();
Assert.assertEquals("de.dagere.peass.ExampleBenchmarkBasic#testMethod", test.getExecutable());
TestCase testUsing = iterator.next();
Assert.assertEquals("de.dagere.peass.ExampleBenchmarkUsing#testMethod", testUsing.getExecutable());
}
use of de.dagere.peass.dependency.analysis.data.TestSet in project peass by DaGeRe.
the class TraceChangeHandler method handleDependencyChanges.
private void handleDependencyChanges(final VersionStaticSelection newVersionStaticSelection, final TestSet testsToRun, final ModuleClassMapping mapping) throws IOException, XmlPullParserException, JsonGenerationException, JsonMappingException {
final TestExistenceChanges testExistenceChanges = dependencyManager.updateDependencies(testsToRun, version, mapping);
final Map<ChangedEntity, Set<TestCase>> addedTestcases = testExistenceChanges.getAddedTests();
if (DETAIL_DEBUG) {
Constants.OBJECTMAPPER.writeValue(new File(folders.getDebugFolder(), "add_" + version + ".json"), addedTestcases);
Constants.OBJECTMAPPER.writeValue(new File(folders.getDebugFolder(), "remove_" + version + ".json"), testExistenceChanges.getRemovedTests());
}
DependencyReaderUtil.removeDeletedTestcases(newVersionStaticSelection, testExistenceChanges);
DependencyReaderUtil.addNewTestcases(newVersionStaticSelection, addedTestcases);
if (DETAIL_DEBUG)
Constants.OBJECTMAPPER.writeValue(new File(folders.getDebugFolder(), "finalStaticSelection_" + version + ".json"), newVersionStaticSelection);
}
use of de.dagere.peass.dependency.analysis.data.TestSet in project peass by DaGeRe.
the class ExecutionData method addCall.
@JsonIgnore
public void addCall(final String version, final TestCase testcase) {
TestSet executes = versions.get(version);
if (executes == null) {
executes = new TestSet();
versions.put(version, executes);
}
executes.addTest(testcase);
}
Aggregations