Merge pull request #15163 from hmdrzsharifi/BAEL-7157

BAEL-7157: Introduce @SelectMethod for Selecting Methods in @Suite Classes in Junit
This commit is contained in:
davidmartinezbarua 2023-11-11 14:31:43 -03:00 committed by GitHub
commit 0db917b0ce
4 changed files with 36 additions and 2 deletions

View File

@ -45,7 +45,18 @@
<version>${junit-platform.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>${junit-platform.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-commons</artifactId>
<version>${junit-platform.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
@ -70,7 +81,7 @@
<properties>
<jmockit.version>1.49</jmockit.version>
<assertj.version>3.24.2</assertj.version>
<junit-platform.version>1.9.2</junit-platform.version>
<junit-platform.version>1.10.1</junit-platform.version>
<maven-surefire-plugin.version>3.0.0</maven-surefire-plugin.version>
</properties>

View File

@ -10,4 +10,8 @@ public class ClassOneUnitTest {
Assertions.assertTrue(true);
}
@Test
public void whenFalse_thenFalse() {
Assertions.assertFalse(false);
}
}

View File

@ -8,4 +8,9 @@ public class ClassTwoUnitTest {
public void whenTrue_thenTrue() {
Assertions.assertTrue(true);
}
@Test
public void whenFalse_thenFalse() {
Assertions.assertFalse(false);
}
}

View File

@ -0,0 +1,14 @@
package com.baeldung.testsuite.suites;
import com.baeldung.testsuite.ClassOneUnitTest;
import org.junit.platform.suite.api.SelectMethod;
import org.junit.platform.suite.api.Suite;
import org.junit.platform.suite.api.SuiteDisplayName;
@Suite
@SuiteDisplayName("My Test Suite")
@SelectMethod(type = ClassOneUnitTest.class, name = "whenFalse_thenFalse")
@SelectMethod("com.baeldung.testsuite.subpackage.ClassTwoUnitTest#whenFalse_thenFalse")
public class JUnitSelectMethodsSuite {
// runs ClassOneUnitTest and ClassTwoUnitTest
}