pan3793 opened a new pull request, #3438:
URL: https://github.com/apache/maven-surefire/pull/3438

   Depends on #3436.
   
   # SUREFIRE-1639: Add ability to configure JUnit 5 TestExecutionListener
   
   Issue: https://github.com/apache/maven-surefire/issues/2122
   
   ## Description
   
   The `listener` provider property now accepts JUnit Platform
   `TestExecutionListener` classes in addition to JUnit 4
   `org.junit.runner.notification.RunListener` classes.
   
   For each comma-separated entry, whitespace is trimmed and empty entries are
   ignored. The provider then tries, in order:
   
   1. JUnit Platform `TestExecutionListener` (instantiated directly and 
registered
      with the `Launcher`)
   2. JUnit 4 `RunListener` (wrapped in `JUnit4ListenersAdapter`)
   3. otherwise ignored by this provider (TestNG listeners are forwarded to the
      TestNG engine via `testng.listeners`)
   
   ## Changes
   
   - `JUnitPlatformProvider` resolves each `listener` entry as a JUnit Platform
     `TestExecutionListener` or a JUnit 4 `RunListener`, trimming whitespace and
     skipping empty entries.
   - Documents the new `Registering a custom TestExecutionListener` section in
     `maven-surefire-plugin/src/site/markdown/examples/junit-platform.md.vm`.
   - Adds unit test `testExecutionListenerIsConfiguredViaListenerProperty` and 
the
     `junit5-testexecutionlistener` integration test with
     `JUnit5TestExecutionListenerIT`.
   
   ```xml
   <plugin>
     <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-surefire-plugin</artifactId>
     <configuration>
       <properties>
         <property>
           <name>listener</name>
           <value>com.example.MyTestExecutionListener</value>
         </property>
       </properties>
     </configuration>
   </plugin>
   ```
   
   ## How it was tested
   
   - `mvn -pl surefire-providers/surefire-junit-platform test
     -Dtest=JUnitPlatformProviderTest` - 48 tests pass
   - `mvn -pl surefire-providers/surefire-junit-platform checkstyle:check` -
     no violations
   - Integration test `JUnit5TestExecutionListenerIT` verifies end-to-end that
     the configured listener runs in a forked test JVM
   
   ## Checklist
   
   Following this checklist to help us incorporate your
   contribution quickly and easily:
   
    - [x] Each commit in the pull request should have a meaningful subject line 
and body.
    - [x] Write a pull request description that is detailed enough to 
understand what the pull request does, how, and why.
    - [x] Run `mvn clean install` to make sure basic checks pass. A more 
thorough check will
          be performed on your pull request automatically.
    - [ ] You have run the integration tests successfully (`mvn -Prun-its clean 
install`).
   
   If your pull request is about ~20 lines of code you don't need to sign an
   [Individual Contributor License 
Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure
   please ask on the developers list.
   
   To make clear that you license your contribution under
   the [Apache License Version 2.0, January 
2004](http://www.apache.org/licenses/LICENSE-2.0)
   you have to acknowledge this by using the following check-box.
   
    - [x] I hereby declare this contribution to be licenced under the [Apache 
License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   
    - [ ] In any other case, please file an [Apache Individual Contributor 
License Agreement](https://www.apache.org/licenses/icla.pdf).
      (I'm committer of other Apache projects and have already signed the ICLA)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to