Search in sources :

Example 61 with ExecutionConfig

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

the class TestDependencyIteratorBuilder method testNightlyBuildWithoutPrePredecessor.

@Test
public void testNightlyBuildWithoutPrePredecessor() {
    try (MockedStatic<GitUtils> gitUtil = Mockito.mockStatic(GitUtils.class)) {
        gitUtil.when(() -> GitUtils.getName(Mockito.any(), Mockito.any())).thenReturn(VERSION_2);
        ExecutionConfig config = new ExecutionConfig();
        config.setVersionOld(null);
        config.setVersion("HEAD");
        StaticTestSelection dependencies = buildVersionDependencies();
        DependencyIteratorBuilder builder = new DependencyIteratorBuilder(config, dependencies, new PeassFolders(TEMPORARY_FOLDER));
        VersionIteratorGit iterator = builder.getIterator();
        Assert.assertNull(iterator);
        Assert.assertEquals(VERSION_2, builder.getVersion());
        Assert.assertEquals(null, builder.getVersionOld());
    }
}
Also used : VersionIteratorGit(de.dagere.peass.vcs.VersionIteratorGit) GitUtils(de.dagere.peass.vcs.GitUtils) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection) PeassFolders(de.dagere.peass.folders.PeassFolders) Test(org.junit.jupiter.api.Test)

Example 62 with ExecutionConfig

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

the class TestVersionDiff method testJavaContainigPath.

@Test
public void testJavaContainigPath() throws IOException {
    createFile(JAVA_PATH_FILE);
    createFile(NO_SOURCE_FOLDER);
    VersionDiff diff = createVersionDiff();
    ExecutionConfig config = new ExecutionConfig();
    config.getClazzFolders().clear();
    config.getClazzFolders().add("java");
    diff.addChange(JAVA_PATH_FILE, config);
    diff.addChange(NO_SOURCE_FOLDER, config);
    MatcherAssert.assertThat(diff.getChangedClasses(), IsIterableContaining.hasItem(new ChangedEntity("de.dagere.peass.Example")));
    MatcherAssert.assertThat(diff.getChangedClasses(), Matchers.not(IsIterableContaining.hasItem(new ChangedEntity("de.dagere.peass.Example2"))));
}
Also used : VersionDiff(de.dagere.peass.dependency.analysis.data.VersionDiff) ChangedEntity(de.dagere.peass.dependency.analysis.data.ChangedEntity) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) Test(org.junit.jupiter.api.Test)

Example 63 with ExecutionConfig

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

the class TestVersionDiff method testRegularMavenPath.

@Test
public void testRegularMavenPath() throws IOException {
    createFile(MAVEN_PATH_FILE);
    createFile(NO_SOURCE_FOLDER);
    VersionDiff diff = createVersionDiff();
    ExecutionConfig config = new ExecutionConfig();
    diff.addChange(MAVEN_PATH_FILE, config);
    diff.addChange(NO_SOURCE_FOLDER, config);
    MatcherAssert.assertThat(diff.getChangedClasses(), IsIterableContaining.hasItem(new ChangedEntity("de.dagere.peass.Example")));
}
Also used : VersionDiff(de.dagere.peass.dependency.analysis.data.VersionDiff) ChangedEntity(de.dagere.peass.dependency.analysis.data.ChangedEntity) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) Test(org.junit.jupiter.api.Test)

Example 64 with ExecutionConfig

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

the class TestNonIncludedTestRemover method testWithModulesRegular.

@Test
public void testWithModulesRegular() {
    Set<TestCase> tests = new HashSet<TestCase>();
    tests.add(new TestCase("TestA", "method1", "moduleA"));
    tests.add(new TestCase("TestB", "method1", "moduleB"));
    tests.add(new TestCase("TestC", "method1", "moduleC"));
    NonIncludedTestRemover.removeNotIncluded(tests, new ExecutionConfig(Arrays.asList(new String[] { "moduleA§TestA#method1", "TestC" }), "test"));
    System.out.println(tests);
    Assert.assertEquals(1, tests.size());
}
Also used : TestCase(de.dagere.peass.dependency.analysis.data.TestCase) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) HashSet(java.util.HashSet) Test(org.junit.jupiter.api.Test)

Example 65 with ExecutionConfig

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

the class TestNonIncludedTestRemover method testWithModulesSameNameButDifferentModule.

@Test
public void testWithModulesSameNameButDifferentModule() {
    Set<TestCase> tests = new HashSet<TestCase>();
    tests.add(new TestCase("TestA", "method1", "moduleA"));
    tests.add(new TestCase("TestB", "method1", "moduleB"));
    tests.add(new TestCase("TestA", "method1", "moduleC"));
    NonIncludedTestRemover.removeNotIncluded(tests, new ExecutionConfig(Arrays.asList(new String[] { "moduleA§TestA#method1", "TestC" }), "test"));
    System.out.println(tests);
    Assert.assertEquals(1, tests.size());
}
Also used : TestCase(de.dagere.peass.dependency.analysis.data.TestCase) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) HashSet(java.util.HashSet) 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