Search in sources :

Example 1 with ProjectStatistics

use of de.dagere.peass.analysis.measurement.ProjectStatistics in project peass by DaGeRe.

the class ContinuousExecutor method analyzeMeasurements.

private void analyzeMeasurements(final File measurementFolder) throws InterruptedException, IOException, JsonGenerationException, JsonMappingException, XmlPullParserException {
    final ProjectStatistics statistics = new ProjectStatistics();
    TestTransformer testTransformer = ExecutorCreator.createTestTransformer(folders, measurementConfig.getExecutionConfig(), measurementConfig);
    TestExecutor executor = ExecutorCreator.createExecutor(folders, testTransformer, env);
    ModuleClassMapping mapping = new ModuleClassMapping(folders.getProjectFolder(), executor.getModules(), measurementConfig.getExecutionConfig());
    final AnalyseFullData afd = new AnalyseFullData(resultsFolders.getChangeFile(), statistics, mapping, measurementConfig.getStatisticsConfig());
    afd.analyseFolder(measurementFolder);
    Constants.OBJECTMAPPER.writeValue(resultsFolders.getStatisticsFile(), statistics);
}
Also used : TestExecutor(de.dagere.peass.execution.utils.TestExecutor) TestTransformer(de.dagere.peass.testtransformation.TestTransformer) AnalyseFullData(de.dagere.peass.analysis.measurement.AnalyseFullData) ModuleClassMapping(de.dagere.peass.dependency.analysis.ModuleClassMapping) ProjectStatistics(de.dagere.peass.analysis.measurement.ProjectStatistics)

Example 2 with ProjectStatistics

use of de.dagere.peass.analysis.measurement.ProjectStatistics in project peass by DaGeRe.

the class TestChangedIterationReading method testChangedIterationReading.

@Test
public void testChangedIterationReading() throws InterruptedException {
    VersionComparator.setVersions(Arrays.asList(new GitCommit("a23e385264c31def8dcda86c3cf64faa698c62d8", null, null, null), new GitCommit("33ce17c04b5218c25c40137d4d09f40fbb3e4f0f", null, null, null)));
    ProjectStatistics statistics = new ProjectStatistics();
    AnalyseFullData afd = new AnalyseFullData(new File("target/changes.json"), statistics, null, new StatisticsConfig());
    afd.analyseFolder(new File(DATA_FOLDER, "measurement_a23e385264c31def8dcda86c3cf64faa698c62d8_33ce17c04b5218c25c40137d4d09f40fbb3e4f0f/measurements"));
    TestcaseStatistic testcaseStatistic = statistics.getStatistics().get("a23e385264c31def8dcda86c3cf64faa698c62d8").get(new TestCase("de.test.CalleeTest#onlyCallMethod2"));
    System.out.println(testcaseStatistic);
    System.out.println(testcaseStatistic.getDeviationCurrent());
    System.out.println(testcaseStatistic.getDeviationOld());
    MatcherAssert.assertThat(testcaseStatistic.getDeviationCurrent(), Matchers.lessThan(800000d));
    MatcherAssert.assertThat(testcaseStatistic.getDeviationOld(), Matchers.lessThan(800000d));
}
Also used : TestcaseStatistic(de.dagere.peass.measurement.statistics.data.TestcaseStatistic) StatisticsConfig(de.dagere.peass.config.StatisticsConfig) GitCommit(de.dagere.peass.vcs.GitCommit) AnalyseFullData(de.dagere.peass.analysis.measurement.AnalyseFullData) TestCase(de.dagere.peass.dependency.analysis.data.TestCase) ProjectStatistics(de.dagere.peass.analysis.measurement.ProjectStatistics) File(java.io.File) Test(org.junit.jupiter.api.Test)

Example 3 with ProjectStatistics

use of de.dagere.peass.analysis.measurement.ProjectStatistics in project peass-ci-plugin by jenkinsci.

the class TestMeasureVersionAction method testPrefix.

@Test
public void testPrefix() {
    final ProjectChanges changes = getChanges();
    HashMap<String, HistogramValues> measurements = new HashMap<String, HistogramValues>();
    measurements.put("de.package.ClassA#method1", null);
    measurements.put("de.package.ClassA#method2", null);
    measurements.put("de.package.ClassB#method2", null);
    measurements.put("de.package.otherpackage.ClassC#method2", null);
    MeasureVersionAction action = new MeasureVersionAction(new MeasurementConfig(5), changes.getVersion("1"), new ProjectStatistics(), new HashMap<>(), measurements, new HashMap<>());
    Assert.assertEquals("ClassA", action.getReducedName("de.package.ClassA"));
    Assert.assertEquals("otherpackage.ClassC", action.getReducedName("de.package.otherpackage.ClassC"));
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) MeasureVersionAction(de.dagere.peass.ci.MeasureVersionAction) HashMap(java.util.HashMap) ProjectChanges(de.dagere.peass.analysis.changes.ProjectChanges) ProjectStatistics(de.dagere.peass.analysis.measurement.ProjectStatistics) HistogramValues(de.dagere.peass.ci.helper.HistogramValues) Test(org.junit.Test)

Example 4 with ProjectStatistics

use of de.dagere.peass.analysis.measurement.ProjectStatistics in project peass-ci-plugin by jenkinsci.

the class TestMeasureVersionAction method testIsChanged.

@Test
public void testIsChanged() {
    final ProjectChanges changes = getChanges();
    MeasureVersionAction action = new MeasureVersionAction(new MeasurementConfig(5), changes.getVersion("1"), new ProjectStatistics(), new HashMap<>(), new HashMap<>(), new HashMap<>());
    Assert.assertTrue(action.testIsChanged("de.package.ClassA#method1"));
    Assert.assertTrue(action.testIsChanged("de.package.ClassA#method2"));
    Assert.assertTrue(action.testIsChanged("de.package.ClassB#method2"));
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) MeasureVersionAction(de.dagere.peass.ci.MeasureVersionAction) ProjectChanges(de.dagere.peass.analysis.changes.ProjectChanges) ProjectStatistics(de.dagere.peass.analysis.measurement.ProjectStatistics) Test(org.junit.Test)

Example 5 with ProjectStatistics

use of de.dagere.peass.analysis.measurement.ProjectStatistics in project peass-ci-plugin by jenkinsci.

the class TestStatisticsReading method testTestcaseNaming.

@Test
public void testTestcaseNaming() throws JsonParseException, JsonMappingException, IOException {
    File statisticsFile = new File("src/test/resources/statistics.json");
    Constants.OBJECTMAPPER.registerModules(new SimpleModule().addKeyDeserializer(TestCase.class, new TestcaseKeyDeserializer()));
    ProjectStatistics statistics = Constants.OBJECTMAPPER.readValue(statisticsFile, ProjectStatistics.class);
    Map<TestCase, TestcaseStatistic> testcase = statistics.getStatistics().values().iterator().next();
    for (TestCase test : testcase.keySet()) {
        MatcherAssert.assertThat(test.getClazz(), Matchers.not(Matchers.containsString(" ")));
    }
}
Also used : TestcaseStatistic(de.dagere.peass.measurement.statistics.data.TestcaseStatistic) TestCase(de.dagere.peass.dependency.analysis.data.TestCase) TestcaseKeyDeserializer(de.dagere.peass.dependency.analysis.data.deserializer.TestcaseKeyDeserializer) ProjectStatistics(de.dagere.peass.analysis.measurement.ProjectStatistics) File(java.io.File) SimpleModule(com.fasterxml.jackson.databind.module.SimpleModule) Test(org.junit.Test)

Aggregations

ProjectStatistics (de.dagere.peass.analysis.measurement.ProjectStatistics)13 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)6 File (java.io.File)6 TestcaseStatistic (de.dagere.peass.measurement.statistics.data.TestcaseStatistic)5 MeasurementConfig (de.dagere.peass.config.MeasurementConfig)4 Test (org.junit.Test)4 ProjectChanges (de.dagere.peass.analysis.changes.ProjectChanges)3 MeasureVersionAction (de.dagere.peass.ci.MeasureVersionAction)3 Test (org.junit.jupiter.api.Test)3 AnalyseFullData (de.dagere.peass.analysis.measurement.AnalyseFullData)2 HistogramValues (de.dagere.peass.ci.helper.HistogramValues)2 VisualizationFolderManager (de.dagere.peass.ci.helper.VisualizationFolderManager)2 LogFileReader (de.dagere.peass.ci.logs.LogFileReader)2 LogFiles (de.dagere.peass.ci.logs.LogFiles)2 PeassFolders (de.dagere.peass.folders.PeassFolders)2 ResultsFolders (de.dagere.peass.folders.ResultsFolders)2 List (java.util.List)2 SimpleModule (com.fasterxml.jackson.databind.module.SimpleModule)1 Changes (de.dagere.peass.analysis.changes.Changes)1 HistogramReader (de.dagere.peass.ci.helper.HistogramReader)1