apache / apache/maven-surefire

[SUREFIRE-1651] JUnit5 Vintage + Maven-Failsafe + Category = ???

Open
#2,116 10 comments 0 reactions 0 assignees View on GitHub
bug priority:major
Dominant language
Java
Stars
461
Forks
588
Avg merge
1d 8h
Merged PRs (30d)
19

Description

**[Torsten Mingers](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=tmi)** opened **[SUREFIRE-1651](https://issues.apache.org/jira/browse/SUREFIRE-1651?redirect=false)** and commented

I finally managed to switch our test infrastructure to JUnit5. Strictly speaking, it is the first step and the "old" tests are all still JUnit4 and run via the Vintage engine.

I currently have a problem with this combination.

 

**Some details:**
We separate unit tests and integration tests with `@Category` annotations and then filter them out in Surefire and Failsafe. I'll add the setup below.

Since the change to JUnit5-Vintage, filtering has stopped working and all tests are always running.
In JUnit5 the filtering happens via Tags. I can not specify these in JUnit4-based tests.

According to the JUnit5 documentation, the categories should continue to work: https://junit.org/junit5/docs/current/user-guide/#migrating-from-junit4-categories-support

However, in the documentary of Surefire (or Failsafe) only tags covered: https://maven.apache.org/surefire/maven-surefire-plugin/examples/junit-platform.html

The configuration for JUnit5 tags is done in _groups_ as previously with the categories in JUnit4. But the configuration does not seem to work when using JUnit5 Vintage engine to run the tests.

Is there a way to configure the Maven Failsafe and Surefire plugins to work with tags **and** categories?

For a hint, I would be very grateful.

 

**Configuration used**

```


org.apache.maven.plugins
maven-surefire-plugin
2.22.1


**/*.class


net.veda.horizon.test.IntegrationTest, net.veda.horizon.test.IntegrationTestGraphDB, net.veda.horizon.test.IntegrationPermissionTest


...


integrationtest


integrationTest





org.apache.maven.plugins
maven-failsafe-plugin
2.19.1


**/*.java

net.veda.horizon.test.IntegrationTest


...





...

```

 

---

**Affects:** 2.22.1

**Attachments:**
- [IntegrationTestJUnit5Vintage.zip](https://issues.apache.org/jira/secure/attachment/12963611/IntegrationTestJUnit5Vintage.zip) (_5.01 kB_)

1 votes, 4 watchers

Contributor guide

Open the contributing guide

Research direction

Start with the attached IntegrationTestJUnit5Vintage.zip and the Surefire/Failsafe configurations in the issue, focusing on the JUnit 5 Vintage engine and category/group filtering. Reproduce the behavior with the listed plugin versions; done means JUnit 4 categories and JUnit 5 tags can be filtered correctly in both plugins.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.