Search in sources :

Example 1 with StatisticsConfig

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

the class AnalyseFullData method main.

public static void main(final String[] args) throws InterruptedException, JAXBException, JsonParseException, JsonMappingException, IOException {
    final File folder = new File(args[0]);
    if (!folder.getName().equals("measurements")) {
        throw new RuntimeException("Can only be executed with measurements-folder! For searching folders, use FolderSearcher");
    }
    LOG.info("Draw results: " + Constants.DRAW_RESULTS);
    VersionComparator.setDependencies(new StaticTestSelection());
    // final File dependencyFile = new File(args[1]);
    // final Dependencies dependencies = Constants.OBJECTMAPPER.readValue(dependencyFile, Dependencies.class);
    // VersionComparator.setDependencies(dependencies);
    // throw new RuntimeException("adapt if needed");
    ProjectStatistics statistics = new ProjectStatistics();
    final AnalyseFullData analyseFullData = new AnalyseFullData(new File("results/changes.json"), statistics, null, new StatisticsConfig());
    analyseFullData.analyseFolder(folder);
    Constants.OBJECTMAPPER.writeValue(new File("results/statistics.json"), statistics);
}
Also used : StatisticsConfig(de.dagere.peass.config.StatisticsConfig) File(java.io.File) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection)

Example 2 with StatisticsConfig

use of de.dagere.peass.config.StatisticsConfig 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 StatisticsConfig

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

the class StatisticsConfigMixin method getStasticsConfig.

public StatisticsConfig getStasticsConfig() {
    StatisticsConfig config = new StatisticsConfig();
    config.setType1error(getType1error());
    config.setType2error(getType2error());
    config.setStatisticTest(getStatisticTest());
    config.setOutlierFactor(getOutlierFactor());
    return config;
}
Also used : StatisticsConfig(de.dagere.peass.config.StatisticsConfig)

Example 4 with StatisticsConfig

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

use of de.dagere.peass.config.StatisticsConfig 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)

Aggregations

StatisticsConfig (de.dagere.peass.config.StatisticsConfig)5 File (java.io.File)4 GitCommit (de.dagere.peass.vcs.GitCommit)3 ProjectChanges (de.dagere.peass.analysis.changes.ProjectChanges)2 ModuleClassMapping (de.dagere.peass.dependency.analysis.ModuleClassMapping)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 ExecutionConfig (de.dagere.peass.config.ExecutionConfig)1 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)1 StaticTestSelection (de.dagere.peass.dependency.persistence.StaticTestSelection)1 ProjectModules (de.dagere.peass.execution.utils.ProjectModules)1 TestcaseStatistic (de.dagere.peass.measurement.statistics.data.TestcaseStatistic)1 Test (org.junit.jupiter.api.Test)1