Search in sources :

Example 6 with TestcaseStatistic

use of de.dagere.peass.measurement.statistics.data.TestcaseStatistic in project peass by DaGeRe.

the class TestNodePreparatorTreeStructure method testColorSettingRemoved.

@Test
public void testColorSettingRemoved() {
    final MeasuredNode childNode = new MeasuredNode("Call#myMethod", "public void Call.myMethod()", null);
    childNode.setStatistic(new TestcaseStatistic(5.0, Double.NaN, 0.01, Double.NaN, 15, -3, true, 10, 0));
    rootNode.getChildren().add(childNode);
    csd.setNodes(rootNode);
    NodePreparator preparator = new NodePreparator(csd);
    preparator.prepare();
    GraphNode root = preparator.getRootNode();
    Assert.assertEquals(NodePreparator.COLOR_SLOWER, root.getColor());
    Assert.assertEquals(NodePreparator.COLOR_SLOWER, root.getChildren().get(0).getColor());
}
Also used : TestcaseStatistic(de.dagere.peass.measurement.statistics.data.TestcaseStatistic) MeasuredNode(de.dagere.peass.measurement.rca.serialization.MeasuredNode) GraphNode(de.dagere.peass.visualization.GraphNode) NodePreparator(de.dagere.peass.visualization.NodePreparator) Test(org.junit.jupiter.api.Test)

Example 7 with TestcaseStatistic

use of de.dagere.peass.measurement.statistics.data.TestcaseStatistic in project peass by DaGeRe.

the class TestNodePreperatorColor method prepareTree.

private void prepareTree() {
    final TestcaseStatistic statistic = new TestcaseStatistic(1, 2, 0.1, 0.1, 100, 3, true, 3, 5);
    final MeasuredNode child1 = new MeasuredNode("ClassA.method1", "public void ClassA.method1()", "public void ClassA.method1()");
    final MeasuredNode child2 = new MeasuredNode("ClassA.method2", "public void ClassA.method2()", "public void ClassA.method2()");
    root.setChilds(Arrays.asList(new MeasuredNode[] { child1, child2 }));
    final MeasuredNode child11 = new MeasuredNode("ClassA.method11", "public void ClassA.method11()", "public void ClassA.method11()");
    final MeasuredNode child12 = new MeasuredNode("ClassA.method12", "public void ClassA.method12()", "public void ClassA.method12()");
    final MeasuredNode child13 = new MeasuredNode("ClassA.method13", "public void ClassA.method13()", "public void ClassA.method13()");
    child1.setChilds(Arrays.asList(new MeasuredNode[] { child11, child12, child13 }));
    setChildrenStatistic(statistic, root);
}
Also used : TestcaseStatistic(de.dagere.peass.measurement.statistics.data.TestcaseStatistic) MeasuredNode(de.dagere.peass.measurement.rca.serialization.MeasuredNode)

Example 8 with TestcaseStatistic

use of de.dagere.peass.measurement.statistics.data.TestcaseStatistic in project peass by DaGeRe.

the class LevelCauseSearcherTest method testCauseSearchingConstantLevels.

@Test
public void testCauseSearchingConstantLevels() throws InterruptedException, IOException, IllegalStateException, XmlPullParserException, AnalysisConfigurationException, ViewNotFoundException, JAXBException {
    buildRoots();
    CauseSearcherConfig config = new CauseSearcherConfig(new TestCase("Test#test"), false, 0.1, false, true, RCAStrategy.LEVELWISE, 2);
    searchChanges(config);
    StrategyTestUtil.checkChanges(changes);
    final TestcaseStatistic nodeStatistic = data.getNodes().getStatistic();
    final double expectedT = new TTest().t(nodeStatistic.getStatisticsOld(), nodeStatistic.getStatisticsCurrent());
    Assert.assertEquals(expectedT, nodeStatistic.getTvalue(), 0.01);
}
Also used : TestcaseStatistic(de.dagere.peass.measurement.statistics.data.TestcaseStatistic) TTest(org.apache.commons.math3.stat.inference.TTest) TestCase(de.dagere.peass.dependency.analysis.data.TestCase) CauseSearcherConfig(de.dagere.peass.measurement.rca.CauseSearcherConfig) TTest(org.apache.commons.math3.stat.inference.TTest) Test(org.junit.Test)

Example 9 with TestcaseStatistic

use of de.dagere.peass.measurement.statistics.data.TestcaseStatistic 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)

Example 10 with TestcaseStatistic

use of de.dagere.peass.measurement.statistics.data.TestcaseStatistic in project peass-ci-plugin by jenkinsci.

the class TestMeasurementVisualizer method testParameterizedVisualization.

@Test
public void testParameterizedVisualization() {
    HashSet<String> tests = new LinkedHashSet<>();
    tests.add("de.dagere.peass.ExampleTest#test(JUNIT_PARAMETERIZED-0)");
    tests.add("de.dagere.peass.ExampleTest#test(JUNIT_PARAMETERIZED-1)");
    File exampleDataFolder = new File("src/test/resources/demo-results-measurements/measurement_a12a0b7f4c162794fca0e7e3fcc6ea3b3a2cbc2b_49f75e8877c2e9b7cf6b56087121a35fdd73ff8b/");
    Run run = Mockito.mock(Run.class);
    VisualizationFolderManager visualizationFolderManager = Mockito.mock(VisualizationFolderManager.class);
    DefaultMeasurementVisualizer visualizer = new DefaultMeasurementVisualizer(exampleDataFolder, "a12a0b7f4c162794fca0e7e3fcc6ea3b3a2cbc2b", run, visualizationFolderManager, tests);
    visualizer.visualizeMeasurements();
    ArgumentCaptor<MeasurementVisualizationAction> captor = ArgumentCaptor.forClass(MeasurementVisualizationAction.class);
    Mockito.verify(run, Mockito.times(2)).addAction(captor.capture());
    MeasurementVisualizationAction action1 = captor.getAllValues().get(0);
    Assert.assertEquals(action1.getDisplayName(), "measurement_ExampleTest_test(JUNIT_PARAMETERIZED-0)");
    MeasurementVisualizationAction action2 = captor.getAllValues().get(1);
    Assert.assertEquals(action2.getDisplayName(), "measurement_ExampleTest_test(JUNIT_PARAMETERIZED-1)");
    Map<String, TestcaseStatistic> noWarmupStatistics = visualizer.getNoWarmupStatistics();
    Assert.assertTrue(noWarmupStatistics.containsKey("de.dagere.peass.ExampleTest#test(JUNIT_PARAMETERIZED-0)"));
    Assert.assertTrue(noWarmupStatistics.containsKey("de.dagere.peass.ExampleTest#test(JUNIT_PARAMETERIZED-1)"));
}
Also used : LinkedHashSet(java.util.LinkedHashSet) TestcaseStatistic(de.dagere.peass.measurement.statistics.data.TestcaseStatistic) DefaultMeasurementVisualizer(de.dagere.peass.ci.helper.DefaultMeasurementVisualizer) Run(hudson.model.Run) VisualizationFolderManager(de.dagere.peass.ci.helper.VisualizationFolderManager) File(java.io.File) MeasurementVisualizationAction(de.dagere.peass.ci.MeasurementVisualizationAction) Test(org.junit.jupiter.api.Test)

Aggregations

TestcaseStatistic (de.dagere.peass.measurement.statistics.data.TestcaseStatistic)28 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)7 ProjectStatistics (de.dagere.peass.analysis.measurement.ProjectStatistics)5 File (java.io.File)5 Map (java.util.Map)5 SummaryStatistics (org.apache.commons.math3.stat.descriptive.SummaryStatistics)5 Test (org.junit.Test)5 TTest (org.apache.commons.math3.stat.inference.TTest)4 Test (org.junit.jupiter.api.Test)4 BuildMeasurementValues (de.dagere.peass.ci.persistence.BuildMeasurementValues)3 TestMeasurementValues (de.dagere.peass.ci.persistence.TestMeasurementValues)3 MeasurementConfig (de.dagere.peass.config.MeasurementConfig)3 MeasuredNode (de.dagere.peass.measurement.rca.serialization.MeasuredNode)3 LinkedHashMap (java.util.LinkedHashMap)3 JsonIgnore (com.fasterxml.jackson.annotation.JsonIgnore)2 DefaultMeasurementVisualizer (de.dagere.peass.ci.helper.DefaultMeasurementVisualizer)2 TreeBuilder (de.dagere.peass.measurement.rca.helper.TreeBuilder)2 GraphNode (de.dagere.peass.visualization.GraphNode)2 NodePreparator (de.dagere.peass.visualization.NodePreparator)2 SimpleModule (com.fasterxml.jackson.databind.module.SimpleModule)1