[ 
https://issues.apache.org/jira/browse/SUREFIRE-1544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16580977#comment-16580977
 ] 

Christian Stein commented on SUREFIRE-1544:
-------------------------------------------

Hi Kathryn,

your `pom.xml` only refers to `junit-jupiter-api`. That is needed to compile 
your test sources. But you need the JUnit Jupiter test engine at runtime, to 
execute the tests.

Read the documentation here: 
[https://maven.apache.org/surefire/maven-surefire-plugin/examples/junit-platform.html]
{quote}To get started with JUnit Platform, you need to add at least a single 
{{TestEngine}} implementation to your project. For example, if you want to 
write tests with Jupiter, add the test artifact {{junit-jupiter-engine}} to the 
dependencies in POM:
[...]
This will pull in all required dependencies. Among those dependencies is 
{{junit-jupiter-api}} which contains the classes and interfaces your test 
source requires to compile. {{junit-platform-engine}} is also resolved and 
added.
{quote}

> Surefire doesn't pick up tests from junit5
> ------------------------------------------
>
>                 Key: SUREFIRE-1544
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1544
>             Project: Maven Surefire
>          Issue Type: Bug
>            Reporter: Kathryn Newbould
>            Priority: Major
>         Attachments: surefire-plugin-bug.zip
>
>
> *What is happening*
> Given I am using junit5 with a {color:#FF0000}failing{color} test:
> {code:java}
> <groupId>org.junit.jupiter</groupId>
> <artifactId>junit-jupiter-api</artifactId>
> <version>5.1.0-M1</version>
> {code}
> When I `mvn package`
> Then I see 
> {code:java}
> Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 sec
> {code}
> And the jar is successfully created
>  
>  
> *What should happen*
> Given I am using junit5 with a {color:#FF0000}failing{color} test
> When I use `mvn package`
> Then I see
> {code:java}
> Tests run: 0, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.001 sec
> {code}
> And the jar is not successfully created.
> NB:
> This issue can be resolved / worked around in older versions of Apache Maven 
> and two additional plugins like so:
> {code:java}
> <plugin>
>   <artifactId>maven-surefire-plugin</artifactId>
>   <version>2.19.1</version>
>   <dependencies>
>     <dependency>
>       <groupId>org.junit.platform</groupId>
>       <artifactId>junit-platform-surefire-provider</artifactId>
>       <version>1.0.3</version>
>     </dependency>
>     <dependency>
>       <groupId>org.junit.jupiter</groupId>
>       <artifactId>junit-jupiter-engine</artifactId>
>       <version>5.0.3</version>
>     </dependency>
>   </dependencies>
> </plugin>
> {code}
> But using these plugins will *not* work with the latest plugin, and tests are 
> not picked up.
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to