Search in sources :

Example 6 with ModuleClassMapping

use of de.dagere.peass.dependency.analysis.ModuleClassMapping in project peass by DaGeRe.

the class TestAnalyseFullData method testReading.

@Test
public void testReading() throws InterruptedException {
    LinkedList<GitCommit> versions = new LinkedList<GitCommit>();
    versions.add(new GitCommit("946e4318267b56838aa35da0a2a4e5c0528bfe04", "", "", ""));
    versions.add(new GitCommit("fd79b2039667c09167c721b2823425629fad6d11", "", "", ""));
    VersionComparator.setVersions(versions);
    File baseFolder = new File(DATA_READING_FOLDER, "android-example-correct");
    ModuleClassMapping mapping = new ModuleClassMapping(baseFolder, new ProjectModules(new File(baseFolder, "app")), new ExecutionConfig());
    AnalyseFullData afd = new AnalyseFullData(new File("target/test.json"), new ProjectStatistics(), mapping, new StatisticsConfig());
    afd.analyseFolder(REGULAR_DATA_FOLDER);
    ProjectChanges changes = afd.getProjectChanges();
    Set<String> changedTests = changes.getVersion("946e4318267b56838aa35da0a2a4e5c0528bfe04").getTestcaseChanges().keySet();
    MatcherAssert.assertThat(changedTests, Matchers.contains("appĀ§com.example.android_example.ExampleUnitTest"));
}
Also used : GitCommit(de.dagere.peass.vcs.GitCommit) ModuleClassMapping(de.dagere.peass.dependency.analysis.ModuleClassMapping) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) LinkedList(java.util.LinkedList) StatisticsConfig(de.dagere.peass.config.StatisticsConfig) ProjectModules(de.dagere.peass.execution.utils.ProjectModules) ProjectChanges(de.dagere.peass.analysis.changes.ProjectChanges) File(java.io.File) Test(org.junit.Test)

Example 7 with ModuleClassMapping

use of de.dagere.peass.dependency.analysis.ModuleClassMapping in project peass by DaGeRe.

the class TestAnalyseFullData method testReadingWithParams.

@Test
public void testReadingWithParams() throws InterruptedException {
    LinkedList<GitCommit> versions = new LinkedList<GitCommit>();
    versions.add(new GitCommit("49f75e8877c2e9b7cf6b56087121a35fdd73ff8b", "", "", ""));
    versions.add(new GitCommit("a12a0b7f4c162794fca0e7e3fcc6ea3b3a2cbc2b", "", "", ""));
    VersionComparator.setVersions(versions);
    ModuleClassMapping mapping = Mockito.mock(ModuleClassMapping.class);
    ProjectStatistics statistics = new ProjectStatistics();
    AnalyseFullData afd = new AnalyseFullData(new File("target/test.json"), statistics, mapping, new StatisticsConfig());
    afd.analyseFolder(new File(PARAM_DATA_FOLDER, "measurements"));
    ProjectChanges changes = afd.getProjectChanges();
    Set<String> changedTests = changes.getVersion("a12a0b7f4c162794fca0e7e3fcc6ea3b3a2cbc2b").getTestcaseChanges().keySet();
    try {
        System.out.println(Constants.OBJECTMAPPER.writeValueAsString(statistics));
        System.out.println(Constants.OBJECTMAPPER.writeValueAsString(changes));
    } catch (JsonProcessingException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    MatcherAssert.assertThat(changedTests, Matchers.contains("de.dagere.peass.ExampleTest"));
    List<Change> methodChanges = TestChangeReader.checkParameterizedResult(changes);
    Assert.assertEquals(4152486.88, methodChanges.get(0).getOldTime(), 0.1);
}
Also used : GitCommit(de.dagere.peass.vcs.GitCommit) ModuleClassMapping(de.dagere.peass.dependency.analysis.ModuleClassMapping) Change(de.dagere.peass.analysis.changes.Change) LinkedList(java.util.LinkedList) StatisticsConfig(de.dagere.peass.config.StatisticsConfig) ProjectChanges(de.dagere.peass.analysis.changes.ProjectChanges) File(java.io.File) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) Test(org.junit.Test)

Example 8 with ModuleClassMapping

use of de.dagere.peass.dependency.analysis.ModuleClassMapping in project peass by DaGeRe.

the class DependencyManager method initialyGetTraces.

public boolean initialyGetTraces(final String version) throws IOException, InterruptedException, XmlPullParserException {
    if (folders.getTempMeasurementFolder().exists()) {
        FileUtils.deleteDirectory(folders.getTempMeasurementFolder());
    }
    final ModuleClassMapping mapping = new ModuleClassMapping(executor);
    executor.loadClasses();
    TestSet tests = findIncludedTests(mapping);
    runTraceTests(tests, version);
    if (folders.getTempMeasurementFolder().exists()) {
        return readInitialResultFiles(mapping);
    } else {
        return printErrors();
    }
}
Also used : ModuleClassMapping(de.dagere.peass.dependency.analysis.ModuleClassMapping) TestSet(de.dagere.peass.dependency.analysis.data.TestSet)

Example 9 with ModuleClassMapping

use of de.dagere.peass.dependency.analysis.ModuleClassMapping in project peass by DaGeRe.

the class TraceGeneratorStarter method call.

@Override
public Void call() throws Exception {
    StaticTestSelection staticTestSelection = Constants.OBJECTMAPPER.readValue(staticSelectionFile, StaticTestSelection.class);
    String newestVersion = staticTestSelection.getNewestVersion();
    VersionStaticSelection version = staticTestSelection.getVersions().get(newestVersion);
    TestSet tests = version.getTests();
    ExecutionConfig executionConfig = executionMixin.getExecutionConfig();
    NonIncludedTestRemover.removeNotIncluded(tests, executionConfig);
    GitUtils.reset(projectFolder);
    PeassFolders folders = new PeassFolders(projectFolder);
    KiekerResultManager resultsManager = runTests(newestVersion, tests, folders, executionConfig);
    LOG.info("Analyzing tests: {}", tests.getTests());
    mapping = new ModuleClassMapping(folders.getProjectFolder(), resultsManager.getExecutor().getModules(), executionConfig);
    for (TestCase testcase : tests.getTests()) {
        writeTestcase(newestVersion, folders, resultsManager, testcase);
    }
    return null;
}
Also used : TestCase(de.dagere.peass.dependency.analysis.data.TestCase) ModuleClassMapping(de.dagere.peass.dependency.analysis.ModuleClassMapping) VersionStaticSelection(de.dagere.peass.dependency.persistence.VersionStaticSelection) KiekerResultManager(de.dagere.peass.dependency.KiekerResultManager) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection) TestSet(de.dagere.peass.dependency.analysis.data.TestSet) PeassFolders(de.dagere.peass.folders.PeassFolders)

Example 10 with ModuleClassMapping

use of de.dagere.peass.dependency.analysis.ModuleClassMapping 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)

Aggregations

ModuleClassMapping (de.dagere.peass.dependency.analysis.ModuleClassMapping)12 ExecutionConfig (de.dagere.peass.config.ExecutionConfig)7 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)6 TestSet (de.dagere.peass.dependency.analysis.data.TestSet)6 ProjectModules (de.dagere.peass.execution.utils.ProjectModules)5 File (java.io.File)4 Test (org.junit.jupiter.api.Test)4 JmhTestTransformer (de.dagere.peass.dependency.jmh.JmhTestTransformer)3 ProjectChanges (de.dagere.peass.analysis.changes.ProjectChanges)2 StatisticsConfig (de.dagere.peass.config.StatisticsConfig)2 KiekerResultManager (de.dagere.peass.dependency.KiekerResultManager)2 PeassFolders (de.dagere.peass.folders.PeassFolders)2 GitCommit (de.dagere.peass.vcs.GitCommit)2 LinkedList (java.util.LinkedList)2 Test (org.junit.Test)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 Change (de.dagere.peass.analysis.changes.Change)1 AnalyseFullData (de.dagere.peass.analysis.measurement.AnalyseFullData)1 ProjectStatistics (de.dagere.peass.analysis.measurement.ProjectStatistics)1 KiekerConfig (de.dagere.peass.config.KiekerConfig)1