Skip to content

Commit

Permalink
[SUREFIRE-2138] Update JUnit4/JUnit5 versions in ITs
Browse files Browse the repository at this point in the history
- Add 4.13.1 and 4.13.2 to JUnitVersion and JUnit4VersionsIT
- Use 4.13.2 where 4.13 or 4.13.1 was used
- Use 5.9.1 in all tests except if a specific version is needed
- Add the necessary requires for org.junit.jupiter.api to the
  module-info.java where it was still missing
  • Loading branch information
andpab authored and slawekjaranowski committed Jan 3, 2023
1 parent dd70772 commit d3dafe4
Show file tree
Hide file tree
Showing 25 changed files with 66 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
public class JUnit4RerunFailingTestsIT
extends SurefireJUnit4IntegrationTestCase
{
private static final String VERSION = "4.13.2";

private SurefireLauncher unpack()
{
return unpack( "/junit4-rerun-failing-tests" );
Expand All @@ -41,22 +43,22 @@ private SurefireLauncher unpack()
public void testRerunFailingErrorTestsWithOneRetry()
{
OutputValidator outputValidator =
unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.13" ).maven().addGoal(
unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( VERSION ).maven().addGoal(
"-Dsurefire.rerunFailingTestsCount=1" ).withFailure().executeTest().assertTestSuiteResults( 5, 1, 1, 0,
0 );
verifyFailuresOneRetryAllClasses( outputValidator );

outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.13" ).maven().addGoal(
outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( VERSION ).maven().addGoal(
"-Dsurefire.rerunFailingTestsCount=1" ).addGoal(
"-DforkCount=2" ).withFailure().executeTest().assertTestSuiteResults( 5, 1, 1, 0, 0 );
verifyFailuresOneRetryAllClasses( outputValidator );

outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.13" ).maven().addGoal(
outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( VERSION ).maven().addGoal(
"-Dsurefire.rerunFailingTestsCount=1" ).addGoal( "-Dparallel=methods" ).addGoal(
"-DuseUnlimitedThreads=true" ).withFailure().executeTest().assertTestSuiteResults( 5, 1, 1, 0, 0 );
verifyFailuresOneRetryAllClasses( outputValidator );

outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.13" ).maven().addGoal(
outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( VERSION ).maven().addGoal(
"-Dsurefire.rerunFailingTestsCount=1" ).addGoal( "-Dparallel=classes" ).addGoal(
"-DuseUnlimitedThreads=true" ).withFailure().executeTest().assertTestSuiteResults( 5, 1, 1, 0, 0 );
verifyFailuresOneRetryAllClasses( outputValidator );
Expand All @@ -67,24 +69,24 @@ public void testRerunFailingErrorTestsTwoRetry()
{
// Four flakes, both tests have been re-run twice
OutputValidator outputValidator =
unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.13" ).maven().addGoal(
unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( VERSION ).maven().addGoal(
"-Dsurefire.rerunFailingTestsCount=2" ).executeTest().assertTestSuiteResults( 5, 0, 0, 0, 4 );

verifyFailuresTwoRetryAllClasses( outputValidator );

outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.13" ).maven().addGoal(
outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( VERSION ).maven().addGoal(
"-Dsurefire.rerunFailingTestsCount=2" ).addGoal( "-DforkCount=3" ).executeTest()
.assertTestSuiteResults( 5, 0, 0, 0, 4 );

verifyFailuresTwoRetryAllClasses( outputValidator );

outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.13" ).maven().addGoal(
outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( VERSION ).maven().addGoal(
"-Dsurefire.rerunFailingTestsCount=2" ).addGoal( "-Dparallel=methods" ).addGoal(
"-DuseUnlimitedThreads=true" ).executeTest().assertTestSuiteResults( 5, 0, 0, 0, 4 );

verifyFailuresTwoRetryAllClasses( outputValidator );

outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.13" ).maven().addGoal(
outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( VERSION ).maven().addGoal(
"-Dsurefire.rerunFailingTestsCount=2" ).addGoal( "-Dparallel=classes" ).addGoal(
"-DuseUnlimitedThreads=true" ).executeTest().assertTestSuiteResults( 5, 0, 0, 0, 4 );

Expand All @@ -95,22 +97,22 @@ public void testRerunFailingErrorTestsTwoRetry()
public void testRerunFailingErrorTestsFalse()
{
OutputValidator outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion(
"4.13" ).maven().withFailure().executeTest().assertTestSuiteResults( 5, 1, 1, 0, 0 );
VERSION ).maven().withFailure().executeTest().assertTestSuiteResults( 5, 1, 1, 0, 0 );

verifyFailuresNoRetryAllClasses( outputValidator );

outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.13" ).maven().addGoal(
outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( VERSION ).maven().addGoal(
"-DforkCount=3" ).withFailure().executeTest().assertTestSuiteResults( 5, 1, 1, 0, 0 );

verifyFailuresNoRetryAllClasses( outputValidator );

outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.13" ).maven().addGoal(
outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( VERSION ).maven().addGoal(
"-Dparallel=methods" ).addGoal(
"-DuseUnlimitedThreads=true" ).withFailure().executeTest().assertTestSuiteResults( 5, 1, 1, 0, 0 );

verifyFailuresNoRetryAllClasses( outputValidator );

outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.13" ).maven().addGoal(
outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( VERSION ).maven().addGoal(
"-Dparallel=classes" ).addGoal(
"-DuseUnlimitedThreads=true" ).withFailure().executeTest().assertTestSuiteResults( 5, 1, 1, 0, 0 );

Expand All @@ -121,26 +123,26 @@ public void testRerunFailingErrorTestsFalse()
public void testRerunOneTestClass()
{
OutputValidator outputValidator =
unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.13" ).maven().addGoal(
unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( VERSION ).maven().addGoal(
"-Dsurefire.rerunFailingTestsCount=1" ).addGoal(
"-Dtest=FlakyFirstTimeTest" ).withFailure().executeTest().assertTestSuiteResults( 3, 1, 1, 0, 0 );

verifyFailuresOneRetryOneClass( outputValidator );

outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.13" ).maven().addGoal(
outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( VERSION ).maven().addGoal(
"-Dsurefire.rerunFailingTestsCount=1" ).addGoal( "-DforkCount=3" ).addGoal(
"-Dtest=FlakyFirstTimeTest" ).withFailure().executeTest().assertTestSuiteResults( 3, 1, 1, 0, 0 );

verifyFailuresOneRetryOneClass( outputValidator );

outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.13" ).maven().addGoal(
outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( VERSION ).maven().addGoal(
"-Dsurefire.rerunFailingTestsCount=1" ).addGoal( "-Dparallel=methods" ).addGoal(
"-DuseUnlimitedThreads=true" ).addGoal(
"-Dtest=FlakyFirstTimeTest" ).withFailure().executeTest().assertTestSuiteResults( 3, 1, 1, 0, 0 );

verifyFailuresOneRetryOneClass( outputValidator );

outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.13" ).maven().addGoal(
outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( VERSION ).maven().addGoal(
"-Dsurefire.rerunFailingTestsCount=1" ).addGoal( "-Dparallel=classes" ).addGoal(
"-DuseUnlimitedThreads=true" ).addGoal(
"-Dtest=FlakyFirstTimeTest" ).withFailure().executeTest().assertTestSuiteResults( 3, 1, 1, 0, 0 );
Expand All @@ -152,29 +154,29 @@ public void testRerunOneTestClass()
public void testRerunOneTestMethod()
{
OutputValidator outputValidator =
unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.13" ).maven().addGoal(
unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( VERSION ).maven().addGoal(
"-Dsurefire.rerunFailingTestsCount=1" ).addGoal(
"-Dtest=FlakyFirstTimeTest#testFailing*" ).withFailure().executeTest().assertTestSuiteResults( 1, 0, 1,
0, 0 );

verifyFailuresOneRetryOneMethod( outputValidator );

outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.13" ).maven().addGoal(
outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( VERSION ).maven().addGoal(
"-Dsurefire.rerunFailingTestsCount=1" ).addGoal( "-DforkCount=3" ).addGoal(
"-Dtest=FlakyFirstTimeTest#testFailing*" ).withFailure().executeTest().assertTestSuiteResults( 1, 0, 1, 0,
0 );

verifyFailuresOneRetryOneMethod( outputValidator );

outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.13" ).maven().addGoal(
outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( VERSION ).maven().addGoal(
"-Dsurefire.rerunFailingTestsCount=1" ).addGoal( "-Dparallel=methods" ).addGoal(
"-DuseUnlimitedThreads=true" ).addGoal(
"-Dtest=FlakyFirstTimeTest#testFailing*" ).withFailure().executeTest().assertTestSuiteResults( 1, 0, 1, 0,
0 );

verifyFailuresOneRetryOneMethod( outputValidator );

outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.13" ).maven().addGoal(
outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( VERSION ).maven().addGoal(
"-Dsurefire.rerunFailingTestsCount=1" ).addGoal( "-Dparallel=classes" ).addGoal(
"-DuseUnlimitedThreads=true" ).addGoal(
"-Dtest=FlakyFirstTimeTest#testFailing*" ).withFailure().executeTest().assertTestSuiteResults( 1, 0, 1, 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
import static org.apache.maven.surefire.its.JUnitVersion.JUNIT_4_11;
import static org.apache.maven.surefire.its.JUnitVersion.JUNIT_4_12;
import static org.apache.maven.surefire.its.JUnitVersion.JUNIT_4_13;
import static org.apache.maven.surefire.its.JUnitVersion.JUNIT_4_13_1;
import static org.apache.maven.surefire.its.JUnitVersion.JUNIT_4_13_2;
import static org.apache.maven.surefire.its.JUnitVersion.JUNIT_4_2;
import static org.apache.maven.surefire.its.JUnitVersion.JUNIT_4_3;
import static org.apache.maven.surefire.its.JUnitVersion.JUNIT_4_3_1;
Expand Down Expand Up @@ -78,7 +80,9 @@ public static Collection<Object[]> junitVersions()
{ JUNIT_4_10 },
{ JUNIT_4_11 },
{ JUNIT_4_12 },
{ JUNIT_4_13 }
{ JUNIT_4_13 },
{ JUNIT_4_13_1 },
{ JUNIT_4_13_2 }
} );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
@SuppressWarnings( "checkstyle:magicnumber" )
public class JUnitPlatformRerunFailingTestsIT extends SurefireJUnit4IntegrationTestCase
{
private static final String VERSION = "5.5.2";
private static final String VERSION = "5.9.1";

private SurefireLauncher unpack()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ public enum JUnitVersion
JUNIT_4_10( "4.10" ),
JUNIT_4_11( "4.11" ),
JUNIT_4_12( "4.12" ),
JUNIT_4_13( "4.13" );
JUNIT_4_13( "4.13" ),
JUNIT_4_13_1( "4.13.1" ),
JUNIT_4_13_2( "4.13.2" );

private final String version;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<version>4.13.2</version>
</dependency>
</dependencies>
<build>
Expand Down
2 changes: 1 addition & 1 deletion surefire-its/src/test/resources/java9-full-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
24 changes: 12 additions & 12 deletions surefire-its/src/test/resources/junit-4-5/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.6.2</version>
<version>5.9.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>5.6.2</version>
<version>5.9.1</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand All @@ -69,13 +69,13 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.6.2</version>
<version>5.9.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>5.6.2</version>
<version>5.9.1</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand All @@ -86,13 +86,13 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.6.2</version>
<version>5.9.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand All @@ -103,13 +103,13 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.6.2</version>
<version>5.9.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand All @@ -122,7 +122,7 @@
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>5.6.2</version>
<version>5.9.1</version>
</dependency>
</dependencies>
</plugin>
Expand All @@ -135,13 +135,13 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.6.2</version>
<version>5.9.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand All @@ -154,7 +154,7 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.6.2</version>
<version>5.9.1</version>
</dependency>
</dependencies>
</plugin>
Expand Down
2 changes: 1 addition & 1 deletion surefire-its/src/test/resources/junit4/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<name>Test for JUnit 4</name>

<properties>
<junitVersion>4.13</junitVersion>
<junitVersion>4.13.2</junitVersion>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
Expand Down
2 changes: 1 addition & 1 deletion surefire-its/src/test/resources/junit5-modulepath/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.6.2</version>
<version>5.9.1</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
4 changes: 2 additions & 2 deletions surefire-its/src/test/resources/junit5-runner/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.6.2</version>
<version>5.9.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<version>1.6.2</version>
<version>1.9.1</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion surefire-its/src/test/resources/junit5-spock/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.6.2</version>
<version>5.9.1</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.6.2</version>
<version>5.9.1</version>
</dependency>
</dependencies>
</dependencyManagement>
Expand Down
2 changes: 1 addition & 1 deletion surefire-its/src/test/resources/runOrder/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>5.5.2</version>
<version>5.9.1</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.release>${java.specification.version}</maven.compiler.release>
<junit.version>5.3.2</junit.version>
<junit.version>5.9.1</junit.version>
</properties>

<contributors>
Expand Down
2 changes: 1 addition & 1 deletion surefire-its/src/test/resources/surefire-1570/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.6.2</version>
<version>5.9.1</version>
</dependency>
</dependencies>
</dependencyManagement>
Expand Down
Loading

0 comments on commit d3dafe4

Please sign in to comment.