0

I have a parameterized JUnit 5 test, e.g.

@EnumSource(Mode.class)
@ParameterizedTest void shouldRunWithMode(Mode mode) {
    ...

I want to exclude one of the enum cases from running in Maven, as described here:

<plugin>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.22.2</version>
    <configuration>
        <test>!testpackage.SomeTest#shouldRunWithMode[3 three]</test>
    </configuration>
</plugin>

The same thing without the ! would mean inclusion, i.e. execute only this test.

I played around with the exclude expression and the square brackets, but I didn't find a combination to make it work.

A demo project is on GitHub.

7
  • First I recommend to upgrade to most recent version of maven-surefire-pugin cause there had been improvements related to JUnit Jupiter platform...cause you are referencing version 2.22.2 but the docs are 3.0.0-M4 ... Commented Feb 6, 2020 at 7:49
  • Thanks for the hint, @khmarbaise. That's a milestone release, but worth giving a try... but it didn't help :-/ Commented Feb 7, 2020 at 8:17
  • Check the syntax cause your example gives the package testpackage instead of pkg/.. furthermore I would check to use SomeTest.class#shouldRunWithMode... Commented Feb 7, 2020 at 10:21
  • I only have a testpackage, no pkg. And adding .class didn't help. Commented Feb 8, 2020 at 13:55
  • You are using a dot instead of / see the documentation.... Commented Feb 8, 2020 at 14:12

1 Answer 1

0

I dug into the code and found that there is no code for it. It's obviously supported only on JUnit 4.

I reported it as a bug SUREFIRE-1753

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.