use of de.dagere.peass.ci.helper.VisualizationFolderManager in project peass-ci-plugin by jenkinsci.
the class TestRTSLogFileReaderParameterized method testParameterizedReading.
@Test
public void testParameterizedReading() {
VisualizationFolderManager visualizationFoldersMock = Mockito.mock(VisualizationFolderManager.class);
Mockito.when(visualizationFoldersMock.getResultsFolders()).thenReturn(new ResultsFolders(currentDir, "parameterized-demo"));
Mockito.when(visualizationFoldersMock.getPeassFolders()).thenReturn(new PeassFolders(new File(currentDir, "parameterized-demo_peass")));
MeasurementConfig measurementConfig = Mockito.mock(MeasurementConfig.class);
ExecutionConfig executionConfig = new ExecutionConfig();
executionConfig.setVersion(VERSION);
executionConfig.setVersionOld(VERSION_OLD);
Mockito.when(measurementConfig.getExecutionConfig()).thenReturn(executionConfig);
RTSLogFileReader reader = new RTSLogFileReader(visualizationFoldersMock, measurementConfig);
Map<TestCase, RTSLogData> rtsVmRuns = reader.getRtsVmRuns(VERSION);
RTSLogData data = rtsVmRuns.get(new TestCase("de.dagere.peass.ExampleTest", "test", "", "JUNIT_PARAMETERIZED-1"));
Assert.assertNotNull(data);
Assert.assertFalse(data.isParameterizedWithoutIndex());
Assert.assertTrue(data.isSuccess());
Map<TestCase, RTSLogData> rtsVmRunsPredecessor = reader.getRtsVmRuns(VERSION_OLD);
RTSLogData dataImplicitParameterized = rtsVmRunsPredecessor.get(new TestCase("de.dagere.peass.ExampleTest", "test", ""));
Assert.assertNotNull(dataImplicitParameterized);
Assert.assertTrue(dataImplicitParameterized.isParameterizedWithoutIndex());
Assert.assertFalse(dataImplicitParameterized.isSuccess());
}
use of de.dagere.peass.ci.helper.VisualizationFolderManager 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)"));
}
use of de.dagere.peass.ci.helper.VisualizationFolderManager in project peass-ci-plugin by jenkinsci.
the class TestRCAVisualizer method testHTMLGeneration.
@Test
public void testHTMLGeneration() throws Exception {
final File testChangeFile = new File("src/test/resources/demo-results/rca/changes.json");
ProjectChanges changes = Constants.OBJECTMAPPER.readValue(testChangeFile, ProjectChanges.class);
initFolders();
final File visualizationResultFolder = new File(folder.getRoot(), "visualization_result");
final Run run = mockRun(visualizationResultFolder);
// Calls the RCAVisualizer, which should be tested
MeasurementConfig measurementConfig = new MeasurementConfig(2);
measurementConfig.getExecutionConfig().setVersion("b02c92af73e3297be617f4c973a7a63fb603565b");
VisualizationFolderManager visualizationFolders = new VisualizationFolderManager(folder.getRoot(), "project", run);
RCAVisualizer visualizer = new RCAVisualizer(measurementConfig, visualizationFolders, changes, run);
visualizer.visualizeRCA();
testCorrectResult(run, visualizationResultFolder);
}
use of de.dagere.peass.ci.helper.VisualizationFolderManager in project peass-ci-plugin by jenkinsci.
the class RTSLogFileTestUtil method initializeReader.
RTSLogFileReader initializeReader() {
MeasurementConfig peassDemoConfig = new MeasurementConfig(2, VERSION, VERSION_OLD);
VisualizationFolderManager visualizationFolders = Mockito.mock(VisualizationFolderManager.class);
Mockito.when(visualizationFolders.getPeassFolders()).thenReturn(new PeassFolders(testFolder));
Mockito.when(visualizationFolders.getResultsFolders()).thenReturn(new ResultsFolders(localFolder, projectName));
RTSLogFileReader reader = new RTSLogFileReader(visualizationFolders, peassDemoConfig);
return reader;
}
use of de.dagere.peass.ci.helper.VisualizationFolderManager in project peass-ci-plugin by jenkinsci.
the class TestRCALogFileReaderMultimodule method testReading.
@Test
public void testReading() throws JsonParseException, JsonMappingException, IOException {
MeasurementConfig peassDemoConfig = new MeasurementConfig(2, RTSLogFileTestUtil.VERSION, RTSLogFileTestUtil.VERSION_OLD);
VisualizationFolderManager visualizationFolders = Mockito.mock(VisualizationFolderManager.class);
Mockito.when(visualizationFolders.getPeassFolders()).thenReturn(new PeassFolders(testFolder));
Mockito.when(visualizationFolders.getPeassRCAFolders()).thenReturn(new CauseSearchFolders(testFolder));
Mockito.when(visualizationFolders.getResultsFolders()).thenReturn(new ResultsFolders(localFolder, "demo-vis2"));
LogFileReader reader = new LogFileReader(visualizationFolders, peassDemoConfig);
Map<TestCase, List<RCALevel>> rcaTestcases = reader.getRCATestcases();
List<RCALevel> levels = rcaTestcases.get(test);
Assert.assertEquals(1, levels.size());
MatcherAssert.assertThat(levels.get(0).getLogFiles(), Matchers.hasSize(3));
String rtsLog = reader.getRCALog();
Assert.assertEquals("This is a rca log test", rtsLog);
}
Aggregations