Search in sources :

Example 6 with ProjectModules

use of de.dagere.peass.execution.utils.ProjectModules in project peass by DaGeRe.

the class GradleTestExecutor method prepareBuildfile.

private void prepareBuildfile() {
    try {
        lastTmpFile = Files.createTempDirectory(folders.getKiekerTempFolder().toPath(), "kiekerTemp").toFile();
        isAndroid = false;
        ProjectModules modules = getModules();
        LOG.debug("Preparing modules: {}", modules);
        replaceAllBuildfiles(modules);
        for (final File module : modules.getModules()) {
            final File gradleFile = GradleParseHelper.findGradleFile(module);
            editOneBuildfile(gradleFile, modules);
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Also used : ProjectModules(de.dagere.peass.execution.utils.ProjectModules) IOException(java.io.IOException) File(java.io.File)

Example 7 with ProjectModules

use of de.dagere.peass.execution.utils.ProjectModules in project peass by DaGeRe.

the class TestBenchmarkDetection method testBenchmarkDetectionInnerClass.

@Test
public void testBenchmarkDetectionInnerClass() throws FileNotFoundException, IOException, XmlPullParserException {
    JmhTestTransformer jmhTransformer = new JmhTestTransformer(JmhTestConstants.INNER_CLASS_VERSION, JMH_CONFIG);
    ProjectModules modules = new ProjectModules(JmhTestConstants.INNER_CLASS_VERSION);
    TestSet tests = jmhTransformer.findModuleTests(new ModuleClassMapping(JmhTestConstants.INNER_CLASS_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 8 with ProjectModules

use of de.dagere.peass.execution.utils.ProjectModules 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 9 with ProjectModules

use of de.dagere.peass.execution.utils.ProjectModules 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 10 with ProjectModules

use of de.dagere.peass.execution.utils.ProjectModules 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)

Aggregations

ProjectModules (de.dagere.peass.execution.utils.ProjectModules)21 File (java.io.File)19 Test (org.junit.jupiter.api.Test)14 ExecutionConfig (de.dagere.peass.config.ExecutionConfig)12 ModuleClassMapping (de.dagere.peass.dependency.analysis.ModuleClassMapping)5 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)4 TestSet (de.dagere.peass.dependency.analysis.data.TestSet)3 JmhTestTransformer (de.dagere.peass.dependency.jmh.JmhTestTransformer)3 GradleBuildfileEditor (de.dagere.peass.execution.gradle.GradleBuildfileEditor)2 IOException (java.io.IOException)2 LinkedList (java.util.LinkedList)2 ProjectChanges (de.dagere.peass.analysis.changes.ProjectChanges)1 StatisticsConfig (de.dagere.peass.config.StatisticsConfig)1 OneTraceGenerator (de.dagere.peass.dependency.traces.OneTraceGenerator)1 ProcessSuccessTester (de.dagere.peass.execution.processutils.ProcessSuccessTester)1 GitCommit (de.dagere.peass.vcs.GitCommit)1 XmlPullParserException (org.codehaus.plexus.util.xml.pull.XmlPullParserException)1 Test (org.junit.Test)1