Hi,
On 08.07.22 16:18, David Karr wrote:
I had gotten help here with our JUnit 5 transition, and I thought I had it
all working, but now I see that I'm back to the state where our JUnit 5
test suites are being ignored.
From what I understood, I had to ensure that "junit-platform-runner" was
excluded as a dependency. What I have seems to have done this, but only
halfway. The "dependency-tree" doesn't have that artifact. However, when
I generated the effective pom, I DID see that artifact. I'm not sure what
that means.
I run this command line:
mvn -U -Dtest=ComponentTestSuite test
Here's an excerpt of the output:
------------------
[INFO] --- maven-surefire-plugin:3.0.0-M7:test (default-test) @
PlatformPilotMs ---
[INFO] Using auto detected provider
org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
------------------
As you can see, I'm using v3.0.0-M7 of Surefire. I'm using v1.8.2 of
junit-platform, and v5.8.2 of junit-jupiter.
I've designed a parent pom hierarchy that looks like this:
sdk-java-parent:
dependencyManagement includes "ext-bom" pom with scope "import"
dependencies has a block like this:
--------------
<dependency>
<groupId>...</groupId>
<artifactId>seed-sdk-core</artifactId>
<exclusions>
<exclusion>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
</exclusion>
</exclusions>
</dependency>
--------------
The effective pom also has this:
----------------------
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M7</version>
<configuration>
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<argLine>${surefireArgLine}</argLine>
<skipTests>false</skipTests>
<excludes>
<exclude>**/contract/*.java</exclude>
<exclude>**/integration/*.java</exclude>
<exclude>**/component/*.java</exclude>
</excludes>
</configuration>
</plugin>
-------------------
What could we be missing?
Which dependencies do you have defined for running junit jupiter tests?
Why do you think you need to exclude junit jupiter runner?
Do you use the dependency junit-jupiter-engine as a dependency:
Are you using @Suite annotation of JUnit Jupiter?
Have you defined a class for example `ComponentTestSuite` like this:
@Suite
@SelectPackages("package.xxx")
@IncludeClassNamePatterns(".*Pattern")
class SuiteDemoTests {
}..
If you like to run suites you have to have two dependencies:
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-suite-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
Kind regards
Karl Heinz Marbaise
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org