Search in sources :

Example 31 with ExecutionConfig

use of de.dagere.peass.config.ExecutionConfig in project peass by DaGeRe.

the class JmhDependencyReaderTest method mockIterator.

private FakeFileIterator mockIterator() {
    List<File> versionList = Arrays.asList(JmhTestConstants.BASIC_VERSION, JmhTestConstants.SLOWER_VERSION);
    FakeFileIterator fakeIterator = new FakeFileIterator(TestConstants.CURRENT_FOLDER, versionList);
    fakeIterator.goToFirstCommit();
    FakeFileIterator iteratorspied = Mockito.spy(fakeIterator);
    VersionDiff fakedDiff = new VersionDiff(Arrays.asList(TestConstants.CURRENT_FOLDER), TestConstants.CURRENT_FOLDER);
    ExecutionConfig defaultConfig = new ExecutionConfig();
    fakedDiff.addChange("src/test/java/de/dagere/peass/ExampleBenchmark.java", defaultConfig);
    Mockito.doReturn(fakedDiff).when(iteratorspied).getChangedClasses(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any());
    return iteratorspied;
}
Also used : FakeFileIterator(de.dagere.peass.dependencytests.helper.FakeFileIterator) VersionDiff(de.dagere.peass.dependency.analysis.data.VersionDiff) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) File(java.io.File)

Example 32 with ExecutionConfig

use of de.dagere.peass.config.ExecutionConfig in project peass by DaGeRe.

the class JmhDependencyReaderTest method testVersionReading.

@ParameterizedTest
@ArgumentsSource(KiekerConfigurationProvider.class)
public void testVersionReading(final KiekerConfig kiekerConfig) throws IOException, InterruptedException, XmlPullParserException, ParseException, ViewNotFoundException, ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
    try (MockedStatic<GitUtils> gitUtilsMock = Mockito.mockStatic(GitUtils.class)) {
        FakeGitUtil.prepareGitUtils(gitUtilsMock);
        FakeFileIterator iterator = mockIterator();
        ResultsFolders resultsFolders = new ResultsFolders(TraceGettingIT.VIEW_IT_PROJECTFOLDER, "test");
        TestSelectionConfig dependencyConfig = new TestSelectionConfig(1, false, true, false);
        ExecutionConfig jmhConfig = new ExecutionConfig();
        jmhConfig.setTestTransformer("de.dagere.peass.dependency.jmh.JmhTestTransformer");
        jmhConfig.setTestExecutor("de.dagere.peass.dependency.jmh.JmhTestExecutor");
        DependencyReader reader = new DependencyReader(dependencyConfig, new PeassFolders(TestConstants.CURRENT_FOLDER), resultsFolders, "", iterator, new VersionKeeper(new File("/dev/null")), jmhConfig, kiekerConfig, new EnvironmentVariables());
        reader.readInitialVersion();
        checkInitialVersion(resultsFolders);
        reader.readDependencies();
        checkChangedVersion(resultsFolders);
    }
}
Also used : TestSelectionConfig(de.dagere.peass.config.TestSelectionConfig) VersionKeeper(de.dagere.peass.dependency.reader.VersionKeeper) FakeFileIterator(de.dagere.peass.dependencytests.helper.FakeFileIterator) EnvironmentVariables(de.dagere.peass.execution.utils.EnvironmentVariables) GitUtils(de.dagere.peass.vcs.GitUtils) DependencyReader(de.dagere.peass.dependency.reader.DependencyReader) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) ResultsFolders(de.dagere.peass.folders.ResultsFolders) File(java.io.File) PeassFolders(de.dagere.peass.folders.PeassFolders) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) ArgumentsSource(org.junit.jupiter.params.provider.ArgumentsSource)

Example 33 with ExecutionConfig

use of de.dagere.peass.config.ExecutionConfig 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 34 with ExecutionConfig

use of de.dagere.peass.config.ExecutionConfig in project peass by DaGeRe.

the class TestTreeReaderWrongConfig method getTree.

public CallTreeNode getTree() throws IOException, XmlPullParserException, InterruptedException, FileNotFoundException, ViewNotFoundException, AnalysisConfigurationException {
    KiekerConfig wrongKiekerConfig = new KiekerConfig(true);
    wrongKiekerConfig.setUseAggregation(true);
    wrongKiekerConfig.setRecord(AllowedKiekerRecord.DURATION);
    final MeasurementConfig config = new MeasurementConfig(1, new ExecutionConfig(15), wrongKiekerConfig);
    TreeReader executor = TreeReaderFactory.createTestTreeReader(projectFolder, config, new EnvironmentVariables());
    TestCase test = new TestCase("defaultpackage.TestMe", "testMe");
    // executor.executeKoPeMeKiekerRun(new TestSet(test), "1");
    CallTreeNode node = executor.getTree(test, "1");
    return node;
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) EnvironmentVariables(de.dagere.peass.execution.utils.EnvironmentVariables) TestCase(de.dagere.peass.dependency.analysis.data.TestCase) TreeReader(de.dagere.peass.measurement.rca.kieker.TreeReader) CallTreeNode(de.dagere.peass.measurement.rca.data.CallTreeNode) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) KiekerConfig(de.dagere.peass.config.KiekerConfig)

Example 35 with ExecutionConfig

use of de.dagere.peass.config.ExecutionConfig in project peass-ci-plugin by jenkinsci.

the class MeasurementActionCreator method createMeasurementActions.

public void createMeasurementActions(final Set<TestCase> tests) throws IOException {
    createOverallLogAction();
    Map<TestCase, List<LogFiles>> logFiles = reader.readAllTestcases(tests);
    createLogActions(run, logFiles);
    ExecutionConfig executionConfig = measurementConfig.getExecutionConfig();
    String shortVersion = executionConfig.getVersion().substring(0, 6);
    String shortVersionOld = executionConfig.getVersionOld().substring(0, 6);
    LogOverviewAction logOverviewAction = new LogOverviewAction(logFiles, shortVersion, shortVersionOld, measurementConfig.getVms(), executionConfig.isRedirectSubprocessOutputToFile());
    run.addAction(logOverviewAction);
}
Also used : TestCase(de.dagere.peass.dependency.analysis.data.TestCase) List(java.util.List) ExecutionConfig(de.dagere.peass.config.ExecutionConfig)

Aggregations

ExecutionConfig (de.dagere.peass.config.ExecutionConfig)74 Test (org.junit.jupiter.api.Test)49 File (java.io.File)40 PeassFolders (de.dagere.peass.folders.PeassFolders)29 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)23 KiekerConfig (de.dagere.peass.config.KiekerConfig)21 EnvironmentVariables (de.dagere.peass.execution.utils.EnvironmentVariables)20 ChangedEntity (de.dagere.peass.dependency.analysis.data.ChangedEntity)14 StaticTestSelection (de.dagere.peass.dependency.persistence.StaticTestSelection)14 FakeFileIterator (de.dagere.peass.dependencytests.helper.FakeFileIterator)13 TestSet (de.dagere.peass.dependency.analysis.data.TestSet)12 ProjectModules (de.dagere.peass.execution.utils.ProjectModules)12 DependencyReader (de.dagere.peass.dependency.reader.DependencyReader)11 VersionIteratorGit (de.dagere.peass.vcs.VersionIteratorGit)11 GitUtils (de.dagere.peass.vcs.GitUtils)10 ResultsFolders (de.dagere.peass.folders.ResultsFolders)9 ModuleClassMapping (de.dagere.peass.dependency.analysis.ModuleClassMapping)7 VersionIterator (de.dagere.peass.vcs.VersionIterator)7 HashSet (java.util.HashSet)7 ChangeManager (de.dagere.peass.dependency.ChangeManager)6