Search in sources :

Example 36 with ExecutionConfig

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());
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) TestCase(de.dagere.peass.dependency.analysis.data.TestCase) RTSLogData(de.dagere.peass.ci.logs.rts.RTSLogData) RTSLogFileReader(de.dagere.peass.ci.logs.RTSLogFileReader) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) VisualizationFolderManager(de.dagere.peass.ci.helper.VisualizationFolderManager) ResultsFolders(de.dagere.peass.folders.ResultsFolders) File(java.io.File) PeassFolders(de.dagere.peass.folders.PeassFolders) Test(org.junit.jupiter.api.Test)

Example 37 with ExecutionConfig

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();
    }
}
Also used : ReadProperties(de.dagere.peass.ReadProperties) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) ResultsFolders(de.dagere.peass.folders.ResultsFolders) PropertyReader(de.dagere.peass.analysis.properties.PropertyReader) File(java.io.File) ExecutionData(de.dagere.peass.dependency.persistence.ExecutionData)

Example 38 with ExecutionConfig

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;
}
Also used : VersionKeeper(de.dagere.peass.dependency.reader.VersionKeeper) EnvironmentVariables(de.dagere.peass.execution.utils.EnvironmentVariables) DependencyReader(de.dagere.peass.dependency.reader.DependencyReader) VersionIterator(de.dagere.peass.vcs.VersionIterator) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) File(java.io.File) PeassFolders(de.dagere.peass.folders.PeassFolders)

Example 39 with ExecutionConfig

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"));
}
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 40 with ExecutionConfig

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());
}
Also used : VersionIteratorGit(de.dagere.peass.vcs.VersionIteratorGit) EnvironmentVariables(de.dagere.peass.execution.utils.EnvironmentVariables) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) File(java.io.File) KiekerConfig(de.dagere.peass.config.KiekerConfig) PeassFolders(de.dagere.peass.folders.PeassFolders) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection) ExecutionData(de.dagere.peass.dependency.persistence.ExecutionData) Order(org.junit.jupiter.api.Order) TestMethodOrder(org.junit.jupiter.api.TestMethodOrder) Test(org.junit.jupiter.api.Test)

Aggregations

ExecutionConfig (de.dagere.peass.config.ExecutionConfig)74 Test (org.junit.jupiter.api.Test)49 File (java.io.File)40 PeassFolders (de.dagere.peass.folders.PeassFolders)29 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)23 KiekerConfig (de.dagere.peass.config.KiekerConfig)21 EnvironmentVariables (de.dagere.peass.execution.utils.EnvironmentVariables)20 ChangedEntity (de.dagere.peass.dependency.analysis.data.ChangedEntity)14 StaticTestSelection (de.dagere.peass.dependency.persistence.StaticTestSelection)14 FakeFileIterator (de.dagere.peass.dependencytests.helper.FakeFileIterator)13 TestSet (de.dagere.peass.dependency.analysis.data.TestSet)12 ProjectModules (de.dagere.peass.execution.utils.ProjectModules)12 DependencyReader (de.dagere.peass.dependency.reader.DependencyReader)11 VersionIteratorGit (de.dagere.peass.vcs.VersionIteratorGit)11 GitUtils (de.dagere.peass.vcs.GitUtils)10 ResultsFolders (de.dagere.peass.folders.ResultsFolders)9 ModuleClassMapping (de.dagere.peass.dependency.analysis.ModuleClassMapping)7 VersionIterator (de.dagere.peass.vcs.VersionIterator)7 HashSet (java.util.HashSet)7 ChangeManager (de.dagere.peass.dependency.ChangeManager)6