Search in sources :

Example 56 with TestSet

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());
}
Also used : JmhTestTransformer(de.dagere.peass.dependency.jmh.JmhTestTransformer) TestCase(de.dagere.peass.dependency.analysis.data.TestCase) File(java.io.File) TestSet(de.dagere.peass.dependency.analysis.data.TestSet) Test(org.junit.jupiter.api.Test)

Example 57 with TestSet

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());
}
Also used : JmhTestTransformer(de.dagere.peass.dependency.jmh.JmhTestTransformer) ProjectModules(de.dagere.peass.execution.utils.ProjectModules) TestCase(de.dagere.peass.dependency.analysis.data.TestCase) ModuleClassMapping(de.dagere.peass.dependency.analysis.ModuleClassMapping) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) TestSet(de.dagere.peass.dependency.analysis.data.TestSet) Test(org.junit.jupiter.api.Test)

Example 58 with TestSet

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());
}
Also used : JmhTestTransformer(de.dagere.peass.dependency.jmh.JmhTestTransformer) ProjectModules(de.dagere.peass.execution.utils.ProjectModules) TestCase(de.dagere.peass.dependency.analysis.data.TestCase) ModuleClassMapping(de.dagere.peass.dependency.analysis.ModuleClassMapping) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) File(java.io.File) TestSet(de.dagere.peass.dependency.analysis.data.TestSet) Test(org.junit.jupiter.api.Test)

Example 59 with TestSet

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);
}
Also used : Set(java.util.Set) TestSet(de.dagere.peass.dependency.analysis.data.TestSet) TestExistenceChanges(de.dagere.peass.dependency.analysis.data.TestExistenceChanges) ChangedEntity(de.dagere.peass.dependency.analysis.data.ChangedEntity) File(java.io.File)

Example 60 with TestSet

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);
}
Also used : TestSet(de.dagere.peass.dependency.analysis.data.TestSet) JsonIgnore(com.fasterxml.jackson.annotation.JsonIgnore)

Aggregations

TestSet (de.dagere.peass.dependency.analysis.data.TestSet)71 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)41 File (java.io.File)19 ChangedEntity (de.dagere.peass.dependency.analysis.data.ChangedEntity)16 Test (org.junit.jupiter.api.Test)15 ExecutionConfig (de.dagere.peass.config.ExecutionConfig)12 VersionStaticSelection (de.dagere.peass.dependency.persistence.VersionStaticSelection)10 Set (java.util.Set)8 ExecutionData (de.dagere.peass.dependency.persistence.ExecutionData)7 Map (java.util.Map)7 ModuleClassMapping (de.dagere.peass.dependency.analysis.ModuleClassMapping)6 JsonIgnore (com.fasterxml.jackson.annotation.JsonIgnore)5 ChangeManager (de.dagere.peass.dependency.ChangeManager)5 StaticTestSelection (de.dagere.peass.dependency.persistence.StaticTestSelection)5 DependencyReader (de.dagere.peass.dependency.reader.DependencyReader)5 FakeFileIterator (de.dagere.peass.dependencytests.helper.FakeFileIterator)5 PeassFolders (de.dagere.peass.folders.PeassFolders)5 VersionIterator (de.dagere.peass.vcs.VersionIterator)5 JmhTestTransformer (de.dagere.peass.dependency.jmh.JmhTestTransformer)4 LinkedHashMap (java.util.LinkedHashMap)4