On 08.07.22 18:09, David Karr wrote:
Inline.
On Fri, Jul 8, 2022 at 8:17 AM Karl Heinz Marbaise <khmarba...@gmx.de
<mailto:khmarba...@gmx.de>> wrote:
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?
These are the resulting junit-jupiter dependencies in the effective pom:
junit-jupiter
junit-jupiter-api
junit-jupiter-engine
junit-jupiter-migrationsupport
junit-jupiter-params
Migrationsupport means JUnit 4... not JUnit Jupiter..
Check the example:
https://github.com/khmarbaise/youtube-videos/tree/episode-4/episode-4
Kind regards
Karl Heinz Marbaise
And these are the resulting junit-platform dependencies (still not sure
why junit-platform-runner is in here, when I'm excluding it AND it
doesn't appear in dependency:tree):
junit-platform-commons
junit-platform-console
junit-platform-engine
junit-platform-jfr
junit-platform-launcher
junit-platform-reporting
junit-platform-runner
junit-platform-suite
junit-platform-suite-api
junit-platform-suite-commons
junit-platform-suite-engine
junit-platform-testkit
Why do you think you need to exclude junit jupiter runner?
Not jupiter, but "junit-platform-runner". Looking at the message
history, I see that "Slawomir Jaranowski" at least, had said this.
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 {
}..
This is an excerpt of my test suite:
------------
import org.junit.platform.suite.api.SelectClasses;
import org.junit.platform.suite.api.Suite;
@Suite
@SelectClasses({...
----------
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