Re: Surefire not running JUnit 5 tests after fixing how junit-bom artifacts are specified

2022-06-18 Thread David Karr
In my case, it appears that all I had to do after adding the correct
junit-bom version import before the import of the
"spring-boot-dependencies" bom was figure out where to exclude
junit-platform-runner. I can see where the junit-{platform,jupiter}
dependencies are in the tree, but it's a little harder to tell what bom
they came from (is that one of the points about a recent discussion about
improvements to dependency:tree?)

On Sat, Jun 18, 2022 at 3:03 AM Karl Heinz Marbaise 
wrote:

> Hi,
>
>
> On 17.06.22 20:46, David Karr wrote:
> > Ok, what is the proper way to do that, considering I have the following
> in
> > a bom imported by my parent pom:
> > 
> >  
> >  org.junit
> >  junit-bom
> >  import
> >  pom
> >  5.8.2
> >  
> >  
> >  
> >org.springframework.boot
> >spring-boot-dependencies
> >${spring-boot.version}
> >pom
> >import
> >  
> > 
> > Do I add an exclusion to one or both of these?
>
>
> This is to have the available dependencies.
> You have to add junit-jupiter-engine
>
> like this (not inside dependencyManagement):
>
>
>  
>  
>  org.junit.jupiter
>  junit-jupiter-engine
>  test
>  
>  
>  org.springframework.boot
>  spring-boot-starter-test
>  test
>  
>
>
> If you have a mix of JUNit 4 and JUnit 5 you have to go this way:
>
>  
>  
>  org.junit.jupiter
>  junit-jupiter-engine
>  test
>  
>  
>  org.junit.vintage
>  junit-vintage-engine
>  test
>  
>  
>  org.springframework.boot
>  spring-boot-starter-test
>  test
>  
>
> The vintage-engine is responsible for executing the JUnit 4 tests.
>
>
> I have made an simple example with Spring Boot using JUnit 4 and JUnit 5.
>
> Also added exemplary integration tests where one is JUnit 4 based and
> one JUnit 5 based.
>
> https://github.com/khmarbaise/minimal-junit4-junit5
>
>
> Furthermore you shouldn't define the provider for surefire explicit
> because it's identifying it itself. (In the given example I have not
> defined the provider).
>
>
> Kind regards
> Karl Heinz Marbaise
> >
> > On Fri, Jun 17, 2022 at 11:37 AM Slawomir Jaranowski <
> s.jaranow...@gmail.com>
> > wrote:
> >
> >> Do you have on your classpath - junit-platform-runner?
> >> Please remove it.
> >>
> >>
> >> pt., 17 cze 2022 o 20:23 David Karr 
> >> napisał(a):
> >>
> >>> I'm posting a new note, as this might be a different issue.
> >>>
> >>> I recently got good advice on this list about how to properly specify
> the
> >>> version overrides for the junit-bom artifacts.  When I implemented
> that,
> >> I
> >>> saw that I was consistently getting the correct versions for those
> >>> artifacts.
> >>>
> >>> However, I'm now confused by the behavior that I'm seeing from
> >> Surefire.  I
> >>> currently have a mix of JUnit 4 and JUnit 5 tests.  I'm pretty sure
> that
> >> I
> >>> had this working before, but now I see that it is not running any of
> the
> >>> JUnit 5 tests.
> >>>
> >>> Note the following excerpt from my build:
> >>> ---
> >>> [INFO] --- maven-surefire-plugin:3.0.0-M7:test (default-test) @
> >>> PlatformPilotMs ---
> >>> [INFO] Using auto detected provider
> >>> org.apache.maven.surefire.junit4.JUnit4Provider
> >>> --
> >>>
> >>> I'm using the very latest M version, as that resolves other issues
> we've
> >>> been having. When I look to see what tests were executed, I see that it
> >>> doesn't include any of my JUnit 5 tests.
> >>>
> >>> I ran "mvn dependency:tree" to verify what versions of JUnit are in the
> >>> classpath, and it has BOTH JUnit 4.13 and junit-platform 1.8.2 and
> >>> junit-jupiter 5.8.2.  The surefire doc page says "Surefire normally
> >>> automatically selects which test-framework provider to use based on the
> >>> version of TestNG/JUnit present in your project's classpath". Is the
> fact
> >>> that both are in the classpath causing this? Am I going to have to
> >> manually
> >>> specify both the junit 4 and junit 5 providers in the surefire
> >>> dependencies? That is additionally annoying as I also have to
> redundantly
> >>> specify the versions of those artifacts (I tried not specifying a
> >> version,
> >>> and it complained).
> >>>
> >>
> >>
> >> --
> >> Sławomir Jaranowski
> >>
> >
>
>


Re: Surefire not running JUnit 5 tests after fixing how junit-bom artifacts are specified

2022-06-18 Thread Karl Heinz Marbaise

Hi,


On 17.06.22 20:46, David Karr wrote:

Ok, what is the proper way to do that, considering I have the following in
a bom imported by my parent pom:

 
 org.junit
 junit-bom
 import
 pom
 5.8.2
 
 
 
   org.springframework.boot
   spring-boot-dependencies
   ${spring-boot.version}
   pom
   import
 

Do I add an exclusion to one or both of these?



This is to have the available dependencies.
You have to add junit-jupiter-engine

like this (not inside dependencyManagement):




org.junit.jupiter
junit-jupiter-engine
test


org.springframework.boot
spring-boot-starter-test
test



If you have a mix of JUNit 4 and JUnit 5 you have to go this way:



org.junit.jupiter
junit-jupiter-engine
test


org.junit.vintage
junit-vintage-engine
test


org.springframework.boot
spring-boot-starter-test
test


The vintage-engine is responsible for executing the JUnit 4 tests.


I have made an simple example with Spring Boot using JUnit 4 and JUnit 5.

Also added exemplary integration tests where one is JUnit 4 based and
one JUnit 5 based.

https://github.com/khmarbaise/minimal-junit4-junit5


Furthermore you shouldn't define the provider for surefire explicit
because it's identifying it itself. (In the given example I have not
defined the provider).


Kind regards
Karl Heinz Marbaise


On Fri, Jun 17, 2022 at 11:37 AM Slawomir Jaranowski 
wrote:


Do you have on your classpath - junit-platform-runner?
Please remove it.


pt., 17 cze 2022 o 20:23 David Karr 
napisał(a):


I'm posting a new note, as this might be a different issue.

I recently got good advice on this list about how to properly specify the
version overrides for the junit-bom artifacts.  When I implemented that,

I

saw that I was consistently getting the correct versions for those
artifacts.

However, I'm now confused by the behavior that I'm seeing from

Surefire.  I

currently have a mix of JUnit 4 and JUnit 5 tests.  I'm pretty sure that

I

had this working before, but now I see that it is not running any of the
JUnit 5 tests.

Note the following excerpt from my build:
---
[INFO] --- maven-surefire-plugin:3.0.0-M7:test (default-test) @
PlatformPilotMs ---
[INFO] Using auto detected provider
org.apache.maven.surefire.junit4.JUnit4Provider
--

I'm using the very latest M version, as that resolves other issues we've
been having. When I look to see what tests were executed, I see that it
doesn't include any of my JUnit 5 tests.

I ran "mvn dependency:tree" to verify what versions of JUnit are in the
classpath, and it has BOTH JUnit 4.13 and junit-platform 1.8.2 and
junit-jupiter 5.8.2.  The surefire doc page says "Surefire normally
automatically selects which test-framework provider to use based on the
version of TestNG/JUnit present in your project's classpath". Is the fact
that both are in the classpath causing this? Am I going to have to

manually

specify both the junit 4 and junit 5 providers in the surefire
dependencies? That is additionally annoying as I also have to redundantly
specify the versions of those artifacts (I tried not specifying a

version,

and it complained).




--
Sławomir Jaranowski






-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org



Re: Surefire not running JUnit 5 tests after fixing how junit-bom artifacts are specified

2022-06-17 Thread David Karr
Never mind, I think I figured this out.  I had two "parent" artifacts with
similar names, and I ran the build in the wrong one. It's still a bit
confusing where the exclusion has to go, but I now have a single exclusion
for junit-platform-runner, in the parent pom, so I don't have to do this in
each service pom.

On Fri, Jun 17, 2022 at 12:26 PM David Karr 
wrote:

> Ok, so the tree has output like this:
> --
> [INFO] +- com.att.idp:idp-seed-sdk-core:jar:2.7.0-SNAPSHOT:compile
> [INFO] |  +- org.junit.jupiter:junit-jupiter-api:jar:5.8.2:compile
> [INFO] |  |  +- org.opentest4j:opentest4j:jar:1.2.0:compile
> [INFO] |  |  \- org.apiguardian:apiguardian-api:jar:1.1.2:compile
> [INFO] |  +- org.junit.jupiter:junit-jupiter-engine:jar:5.8.2:compile
> [INFO] |  +-
> org.junit.jupiter:junit-jupiter-migrationsupport:jar:5.8.2:compile
> [INFO] |  +- org.junit.jupiter:junit-jupiter-params:jar:5.8.2:compile
> [INFO] |  +- org.junit.platform:junit-platform-commons:jar:1.8.2:compile
> [INFO] |  +- org.junit.platform:junit-platform-console:jar:1.8.2:compile
> [INFO] |  +- org.junit.platform:junit-platform-engine:jar:1.8.2:compile
> [INFO] |  +- org.junit.platform:junit-platform-jfr:jar:1.8.2:compile
> [INFO] |  +- org.junit.platform:junit-platform-launcher:jar:1.8.2:compile
> [INFO] |  +- org.junit.platform:junit-platform-reporting:jar:1.8.2:compile
> [INFO] |  +- org.junit.platform:junit-platform-runner:jar:1.8.2:compile
> [INFO] |  +- org.junit.platform:junit-platform-suite:jar:1.8.2:compile
> [INFO] |  +- org.junit.platform:junit-platform-suite-api:jar:1.8.2:compile
> [INFO] |  +-
> org.junit.platform:junit-platform-suite-commons:jar:1.8.2:compile
> [INFO] |  +-
> org.junit.platform:junit-platform-suite-engine:jar:1.8.2:compile
> [INFO] |  +- org.junit.platform:junit-platform-testkit:jar:1.8.2:compile
> [INFO] |  \- org.junit.vintage:junit-vintage-engine:jar:5.8.2:compile
> -
> It's a little hard to see with a proportional font, but the top line there
> is the artifact that references it.  In my parent pom, where this artifact
> is specified, I did the following:
> -
> 
> com.att.idp
> idp-seed-sdk-core
> 
> 
> org.junit.platform
> junit-platform-runner
> 
> 
> 
> 
>
> This made no difference.
>
> The only thing that makes this do what it needs to do is adding the
> "surefire-junit-platform" dependency to the surefire plugin, but I have to
> do that in every service that uses that parent pom. This is the only change
> that runs both the JUnit 4 and JUnit 5 tests.
>
> On Fri, Jun 17, 2022 at 12:13 PM Slawomir Jaranowski <
> s.jaranow...@gmail.com> wrote:
>
>> Import scope only sets versions of dependency - not add it to dependency.
>>
>> Please examine output of dependency:tree and look where is added
>> junit-platform-runner
>>
>> pt., 17 cze 2022 o 20:47 David Karr 
>> napisał(a):
>>
>> > Ok, what is the proper way to do that, considering I have the following
>> in
>> > a bom imported by my parent pom:
>> > 
>> > 
>> > org.junit
>> > junit-bom
>> > import
>> > pom
>> > 5.8.2
>> > 
>> > 
>> > 
>> >   org.springframework.boot
>> >   spring-boot-dependencies
>> >   ${spring-boot.version}
>> >   pom
>> >   import
>> > 
>> > 
>> > Do I add an exclusion to one or both of these?
>> >
>> > On Fri, Jun 17, 2022 at 11:37 AM Slawomir Jaranowski <
>> > s.jaranow...@gmail.com>
>> > wrote:
>> >
>> > > Do you have on your classpath - junit-platform-runner?
>> > > Please remove it.
>> > >
>> > >
>> > > pt., 17 cze 2022 o 20:23 David Karr 
>> > > napisał(a):
>> > >
>> > > > I'm posting a new note, as this might be a different issue.
>> > > >
>> > > > I recently got good advice on this list about how to properly
>> specify
>> > the
>> > > > version overrides for the junit-bom artifacts.  When I implemented
>> > that,
>> > > I
>> > > > saw that I was consistently getting the correct versions for those
>> > > > artifacts.
>> > > >
>> > > > However, I'm now confused by the behavior that I'm seeing from
>> > > Surefire.  I
>> > > > currently have a mix of JUnit 4 and JUnit 5 tests.  I'm pretty sure
>> > that
>> > > I
>> > > > had this working before, but now I see that it is not running any of
>> > the
>> > > > JUnit 5 tests.
>> > > >
>> > > > Note the following excerpt from my build:
>> > > > ---
>> > > > [INFO] --- maven-surefire-plugin:3.0.0-M7:test (default-test) @
>> > > > PlatformPilotMs ---
>> > > > [INFO] Using auto detected provider
>> > > > org.apache.maven.surefire.junit4.JUnit4Provider
>> > > > --
>> > > >
>> > > > I'm using the very latest M version, as that resolves other 

Re: Surefire not running JUnit 5 tests after fixing how junit-bom artifacts are specified

2022-06-17 Thread David Karr
Ok, so the tree has output like this:
--
[INFO] +- com.att.idp:idp-seed-sdk-core:jar:2.7.0-SNAPSHOT:compile
[INFO] |  +- org.junit.jupiter:junit-jupiter-api:jar:5.8.2:compile
[INFO] |  |  +- org.opentest4j:opentest4j:jar:1.2.0:compile
[INFO] |  |  \- org.apiguardian:apiguardian-api:jar:1.1.2:compile
[INFO] |  +- org.junit.jupiter:junit-jupiter-engine:jar:5.8.2:compile
[INFO] |  +-
org.junit.jupiter:junit-jupiter-migrationsupport:jar:5.8.2:compile
[INFO] |  +- org.junit.jupiter:junit-jupiter-params:jar:5.8.2:compile
[INFO] |  +- org.junit.platform:junit-platform-commons:jar:1.8.2:compile
[INFO] |  +- org.junit.platform:junit-platform-console:jar:1.8.2:compile
[INFO] |  +- org.junit.platform:junit-platform-engine:jar:1.8.2:compile
[INFO] |  +- org.junit.platform:junit-platform-jfr:jar:1.8.2:compile
[INFO] |  +- org.junit.platform:junit-platform-launcher:jar:1.8.2:compile
[INFO] |  +- org.junit.platform:junit-platform-reporting:jar:1.8.2:compile
[INFO] |  +- org.junit.platform:junit-platform-runner:jar:1.8.2:compile
[INFO] |  +- org.junit.platform:junit-platform-suite:jar:1.8.2:compile
[INFO] |  +- org.junit.platform:junit-platform-suite-api:jar:1.8.2:compile
[INFO] |  +-
org.junit.platform:junit-platform-suite-commons:jar:1.8.2:compile
[INFO] |  +-
org.junit.platform:junit-platform-suite-engine:jar:1.8.2:compile
[INFO] |  +- org.junit.platform:junit-platform-testkit:jar:1.8.2:compile
[INFO] |  \- org.junit.vintage:junit-vintage-engine:jar:5.8.2:compile
-
It's a little hard to see with a proportional font, but the top line there
is the artifact that references it.  In my parent pom, where this artifact
is specified, I did the following:
-

com.att.idp
idp-seed-sdk-core


org.junit.platform
junit-platform-runner





This made no difference.

The only thing that makes this do what it needs to do is adding the
"surefire-junit-platform" dependency to the surefire plugin, but I have to
do that in every service that uses that parent pom. This is the only change
that runs both the JUnit 4 and JUnit 5 tests.

On Fri, Jun 17, 2022 at 12:13 PM Slawomir Jaranowski 
wrote:

> Import scope only sets versions of dependency - not add it to dependency.
>
> Please examine output of dependency:tree and look where is added
> junit-platform-runner
>
> pt., 17 cze 2022 o 20:47 David Karr 
> napisał(a):
>
> > Ok, what is the proper way to do that, considering I have the following
> in
> > a bom imported by my parent pom:
> > 
> > 
> > org.junit
> > junit-bom
> > import
> > pom
> > 5.8.2
> > 
> > 
> > 
> >   org.springframework.boot
> >   spring-boot-dependencies
> >   ${spring-boot.version}
> >   pom
> >   import
> > 
> > 
> > Do I add an exclusion to one or both of these?
> >
> > On Fri, Jun 17, 2022 at 11:37 AM Slawomir Jaranowski <
> > s.jaranow...@gmail.com>
> > wrote:
> >
> > > Do you have on your classpath - junit-platform-runner?
> > > Please remove it.
> > >
> > >
> > > pt., 17 cze 2022 o 20:23 David Karr 
> > > napisał(a):
> > >
> > > > I'm posting a new note, as this might be a different issue.
> > > >
> > > > I recently got good advice on this list about how to properly specify
> > the
> > > > version overrides for the junit-bom artifacts.  When I implemented
> > that,
> > > I
> > > > saw that I was consistently getting the correct versions for those
> > > > artifacts.
> > > >
> > > > However, I'm now confused by the behavior that I'm seeing from
> > > Surefire.  I
> > > > currently have a mix of JUnit 4 and JUnit 5 tests.  I'm pretty sure
> > that
> > > I
> > > > had this working before, but now I see that it is not running any of
> > the
> > > > JUnit 5 tests.
> > > >
> > > > Note the following excerpt from my build:
> > > > ---
> > > > [INFO] --- maven-surefire-plugin:3.0.0-M7:test (default-test) @
> > > > PlatformPilotMs ---
> > > > [INFO] Using auto detected provider
> > > > org.apache.maven.surefire.junit4.JUnit4Provider
> > > > --
> > > >
> > > > I'm using the very latest M version, as that resolves other issues
> > we've
> > > > been having. When I look to see what tests were executed, I see that
> it
> > > > doesn't include any of my JUnit 5 tests.
> > > >
> > > > I ran "mvn dependency:tree" to verify what versions of JUnit are in
> the
> > > > classpath, and it has BOTH JUnit 4.13 and junit-platform 1.8.2 and
> > > > junit-jupiter 5.8.2.  The surefire doc page says "Surefire normally
> > > > automatically selects which test-framework provider to use based on
> the
> > > > version of TestNG/JUnit present in your project's classpath". Is the
> > fact
> > > > 

Re: Surefire not running JUnit 5 tests after fixing how junit-bom artifacts are specified

2022-06-17 Thread Slawomir Jaranowski
Import scope only sets versions of dependency - not add it to dependency.

Please examine output of dependency:tree and look where is added
junit-platform-runner

pt., 17 cze 2022 o 20:47 David Karr  napisał(a):

> Ok, what is the proper way to do that, considering I have the following in
> a bom imported by my parent pom:
> 
> 
> org.junit
> junit-bom
> import
> pom
> 5.8.2
> 
> 
> 
>   org.springframework.boot
>   spring-boot-dependencies
>   ${spring-boot.version}
>   pom
>   import
> 
> 
> Do I add an exclusion to one or both of these?
>
> On Fri, Jun 17, 2022 at 11:37 AM Slawomir Jaranowski <
> s.jaranow...@gmail.com>
> wrote:
>
> > Do you have on your classpath - junit-platform-runner?
> > Please remove it.
> >
> >
> > pt., 17 cze 2022 o 20:23 David Karr 
> > napisał(a):
> >
> > > I'm posting a new note, as this might be a different issue.
> > >
> > > I recently got good advice on this list about how to properly specify
> the
> > > version overrides for the junit-bom artifacts.  When I implemented
> that,
> > I
> > > saw that I was consistently getting the correct versions for those
> > > artifacts.
> > >
> > > However, I'm now confused by the behavior that I'm seeing from
> > Surefire.  I
> > > currently have a mix of JUnit 4 and JUnit 5 tests.  I'm pretty sure
> that
> > I
> > > had this working before, but now I see that it is not running any of
> the
> > > JUnit 5 tests.
> > >
> > > Note the following excerpt from my build:
> > > ---
> > > [INFO] --- maven-surefire-plugin:3.0.0-M7:test (default-test) @
> > > PlatformPilotMs ---
> > > [INFO] Using auto detected provider
> > > org.apache.maven.surefire.junit4.JUnit4Provider
> > > --
> > >
> > > I'm using the very latest M version, as that resolves other issues
> we've
> > > been having. When I look to see what tests were executed, I see that it
> > > doesn't include any of my JUnit 5 tests.
> > >
> > > I ran "mvn dependency:tree" to verify what versions of JUnit are in the
> > > classpath, and it has BOTH JUnit 4.13 and junit-platform 1.8.2 and
> > > junit-jupiter 5.8.2.  The surefire doc page says "Surefire normally
> > > automatically selects which test-framework provider to use based on the
> > > version of TestNG/JUnit present in your project's classpath". Is the
> fact
> > > that both are in the classpath causing this? Am I going to have to
> > manually
> > > specify both the junit 4 and junit 5 providers in the surefire
> > > dependencies? That is additionally annoying as I also have to
> redundantly
> > > specify the versions of those artifacts (I tried not specifying a
> > version,
> > > and it complained).
> > >
> >
> >
> > --
> > Sławomir Jaranowski
> >
>


-- 
Sławomir Jaranowski


Re: Surefire not running JUnit 5 tests after fixing how junit-bom artifacts are specified

2022-06-17 Thread David Karr
Ok, what is the proper way to do that, considering I have the following in
a bom imported by my parent pom:


org.junit
junit-bom
import
pom
5.8.2



  org.springframework.boot
  spring-boot-dependencies
  ${spring-boot.version}
  pom
  import


Do I add an exclusion to one or both of these?

On Fri, Jun 17, 2022 at 11:37 AM Slawomir Jaranowski 
wrote:

> Do you have on your classpath - junit-platform-runner?
> Please remove it.
>
>
> pt., 17 cze 2022 o 20:23 David Karr 
> napisał(a):
>
> > I'm posting a new note, as this might be a different issue.
> >
> > I recently got good advice on this list about how to properly specify the
> > version overrides for the junit-bom artifacts.  When I implemented that,
> I
> > saw that I was consistently getting the correct versions for those
> > artifacts.
> >
> > However, I'm now confused by the behavior that I'm seeing from
> Surefire.  I
> > currently have a mix of JUnit 4 and JUnit 5 tests.  I'm pretty sure that
> I
> > had this working before, but now I see that it is not running any of the
> > JUnit 5 tests.
> >
> > Note the following excerpt from my build:
> > ---
> > [INFO] --- maven-surefire-plugin:3.0.0-M7:test (default-test) @
> > PlatformPilotMs ---
> > [INFO] Using auto detected provider
> > org.apache.maven.surefire.junit4.JUnit4Provider
> > --
> >
> > I'm using the very latest M version, as that resolves other issues we've
> > been having. When I look to see what tests were executed, I see that it
> > doesn't include any of my JUnit 5 tests.
> >
> > I ran "mvn dependency:tree" to verify what versions of JUnit are in the
> > classpath, and it has BOTH JUnit 4.13 and junit-platform 1.8.2 and
> > junit-jupiter 5.8.2.  The surefire doc page says "Surefire normally
> > automatically selects which test-framework provider to use based on the
> > version of TestNG/JUnit present in your project's classpath". Is the fact
> > that both are in the classpath causing this? Am I going to have to
> manually
> > specify both the junit 4 and junit 5 providers in the surefire
> > dependencies? That is additionally annoying as I also have to redundantly
> > specify the versions of those artifacts (I tried not specifying a
> version,
> > and it complained).
> >
>
>
> --
> Sławomir Jaranowski
>


Re: Surefire not running JUnit 5 tests after fixing how junit-bom artifacts are specified

2022-06-17 Thread Slawomir Jaranowski
Do you have on your classpath - junit-platform-runner?
Please remove it.


pt., 17 cze 2022 o 20:23 David Karr  napisał(a):

> I'm posting a new note, as this might be a different issue.
>
> I recently got good advice on this list about how to properly specify the
> version overrides for the junit-bom artifacts.  When I implemented that, I
> saw that I was consistently getting the correct versions for those
> artifacts.
>
> However, I'm now confused by the behavior that I'm seeing from Surefire.  I
> currently have a mix of JUnit 4 and JUnit 5 tests.  I'm pretty sure that I
> had this working before, but now I see that it is not running any of the
> JUnit 5 tests.
>
> Note the following excerpt from my build:
> ---
> [INFO] --- maven-surefire-plugin:3.0.0-M7:test (default-test) @
> PlatformPilotMs ---
> [INFO] Using auto detected provider
> org.apache.maven.surefire.junit4.JUnit4Provider
> --
>
> I'm using the very latest M version, as that resolves other issues we've
> been having. When I look to see what tests were executed, I see that it
> doesn't include any of my JUnit 5 tests.
>
> I ran "mvn dependency:tree" to verify what versions of JUnit are in the
> classpath, and it has BOTH JUnit 4.13 and junit-platform 1.8.2 and
> junit-jupiter 5.8.2.  The surefire doc page says "Surefire normally
> automatically selects which test-framework provider to use based on the
> version of TestNG/JUnit present in your project's classpath". Is the fact
> that both are in the classpath causing this? Am I going to have to manually
> specify both the junit 4 and junit 5 providers in the surefire
> dependencies? That is additionally annoying as I also have to redundantly
> specify the versions of those artifacts (I tried not specifying a version,
> and it complained).
>


-- 
Sławomir Jaranowski


Surefire not running JUnit 5 tests after fixing how junit-bom artifacts are specified

2022-06-17 Thread David Karr
I'm posting a new note, as this might be a different issue.

I recently got good advice on this list about how to properly specify the
version overrides for the junit-bom artifacts.  When I implemented that, I
saw that I was consistently getting the correct versions for those
artifacts.

However, I'm now confused by the behavior that I'm seeing from Surefire.  I
currently have a mix of JUnit 4 and JUnit 5 tests.  I'm pretty sure that I
had this working before, but now I see that it is not running any of the
JUnit 5 tests.

Note the following excerpt from my build:
---
[INFO] --- maven-surefire-plugin:3.0.0-M7:test (default-test) @
PlatformPilotMs ---
[INFO] Using auto detected provider
org.apache.maven.surefire.junit4.JUnit4Provider
--

I'm using the very latest M version, as that resolves other issues we've
been having. When I look to see what tests were executed, I see that it
doesn't include any of my JUnit 5 tests.

I ran "mvn dependency:tree" to verify what versions of JUnit are in the
classpath, and it has BOTH JUnit 4.13 and junit-platform 1.8.2 and
junit-jupiter 5.8.2.  The surefire doc page says "Surefire normally
automatically selects which test-framework provider to use based on the
version of TestNG/JUnit present in your project's classpath". Is the fact
that both are in the classpath causing this? Am I going to have to manually
specify both the junit 4 and junit 5 providers in the surefire
dependencies? That is additionally annoying as I also have to redundantly
specify the versions of those artifacts (I tried not specifying a version,
and it complained).