use of de.dagere.peass.config.ExecutionConfig 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.config.ExecutionConfig in project peass by DaGeRe.
the class ReadAllProperties method getProperties.
static void getProperties(final RepoFolders folders, final String project) throws JAXBException, IOException, JsonParseException, JsonMappingException, JsonGenerationException {
final File viewFolder = new File(folders.getAllViewFolder(), "views_" + project);
final File executionFile = new File(folders.getDependencyFolder(), ResultsFolders.TRACE_SELECTION_PREFIX + project + ".json");
final ExecutionData changedTests = Constants.OBJECTMAPPER.readValue(executionFile, ExecutionData.class);
final File projectFolder = new File("../../projekte/" + project);
if (!projectFolder.exists()) {
GitUtils.downloadProject(changedTests.getUrl(), projectFolder);
}
if (!readAll) {
final File changeFile = new File(folders.getResultsFolder(), project + File.separator + project + ".json");
if (changeFile.exists()) {
final File resultFile = new File(folders.getPropertiesFolder(), project + File.separator + project + ".json");
if (!resultFile.getParentFile().exists()) {
resultFile.getParentFile().mkdir();
}
final ReadProperties reader = new ReadProperties(resultFile);
reader.readChangeProperties(changeFile, projectFolder, viewFolder, changedTests);
} else {
System.err.println("Error: " + changeFile.getAbsolutePath() + " does not exist");
}
} else {
ResultsFolders resultsFolders = new ResultsFolders(folders.getPropertiesFolder().getParentFile(), project);
new PropertyReader(resultsFolders, projectFolder, changedTests, new ExecutionConfig()).readAllTestsProperties();
}
}
use of de.dagere.peass.config.ExecutionConfig in project peass by DaGeRe.
the class RegressionTestSelectionContinueStarter method createReader.
DependencyReader createReader(final TestSelectionConfigMixin config, final ResultsFolders resultsFolders, final StaticTestSelection dependencies, final String previousVersion, final int timeout, final VersionControlSystem vcs) {
final DependencyReader reader;
if (vcs.equals(VersionControlSystem.GIT)) {
final VersionIterator iterator = createIterator(config, previousVersion);
ExecutionConfig executionConfig = executionConfigMixin.getExecutionConfig();
reader = new DependencyReader(config.getDependencyConfig(), new PeassFolders(config.getProjectFolder()), resultsFolders, dependencies.getUrl(), iterator, new VersionKeeper(new File(resultsFolders.getStaticTestSelectionFile().getParentFile(), "nochanges.json")), executionConfig, kiekerConfigMixin.getKiekerConfig(), new EnvironmentVariables());
iterator.goTo0thCommit();
} else if (vcs.equals(VersionControlSystem.SVN)) {
throw new RuntimeException("SVN not supported currently.");
} else {
throw new RuntimeException("Unknown version control system");
}
return reader;
}
use of de.dagere.peass.config.ExecutionConfig 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"));
}
use of de.dagere.peass.config.ExecutionConfig in project peass by DaGeRe.
the class ContinuousDependencyReaderIT method testBasicVersionReading.
@Order(1)
@Test
public void testBasicVersionReading() throws Exception {
builder.addVersion(new File("../dependency/src/test/resources/dependencyIT/normal_change"), "test 1");
VersionIteratorGit iterator = new VersionIteratorGit(TestConstants.CURRENT_FOLDER);
iterator.goToFirstCommit();
iterator.goToNextCommit();
ExecutionConfig executionConfig = new ExecutionConfig();
executionConfig.setVersion(iterator.getTag());
executionConfig.setVersionOld(iterator.getPrevious().getTag());
ContinuousDependencyReader reader = new ContinuousDependencyReader(DependencyTestConstants.DEFAULT_CONFIG_WITH_VIEWS, executionConfig, new KiekerConfig(true), new PeassFolders(TestConstants.CURRENT_FOLDER), resultsFolders, new EnvironmentVariables());
StaticTestSelection dependencies = reader.getDependencies(iterator, "");
final String lastTag = builder.getTags().get(builder.getTags().size() - 1);
checkVersion(dependencies, lastTag, 1);
ExecutionData executions = Constants.OBJECTMAPPER.readValue(resultsFolders.getTraceTestSelectionFile(), ExecutionData.class);
Assert.assertEquals(2, executions.getVersions().size());
System.out.println(executions.getVersions().keySet());
}
Aggregations