netbeans icon indicating copy to clipboard operation
netbeans copied to clipboard

Rerun failed test with maven and junit5 creates the wrong command line.

Open homberghp opened this issue 5 months ago • 2 comments

Apache NetBeans version

Apache NetBeans 26 latest release candidate

What happened

When rerunning a failed test with netbeans IDE and maven, using junit5, the ide composes a command line which has no effect.

The test engine (junit, surefire) can't find the failing methods as specified on the command line.

Language / Project Type / NetBeans Component

java/ maven project using maven, and junit5/ testing

How to reproduce

unzip the attached zip file. Open the (genranges) with NetBeans IDE and run the tests. In the zip file, two tests are broken on purpose for this demonstration. Two tests will fail. To rerun, press the rerun failing tests button. The test UI window shows that no tests are run. Looking at the output window, at the composed command line we see that the command line we see that the test methods are prefixed with their fully qualified test class name, which make the test engine not find the test methods.

The composed command line (abbreviated to the relevant part) is

mvn -Dtest=io.github.jristretto.ranges.RangeTest#io.github.jristretto.ranges.RangeTest.t01Max+io.github.jristretto.ranges.RangeTest.t02Min test

and should be

mvn -Dtest=io.github.jristretto.ranges.RangeTest#t01Max+t02Min test

Did this work correctly in an earlier version?

Apache NetBeans 21 or earlier

Operating System

ubuntu 24.04.2 LTS

JDK

jdk 17

Apache NetBeans packaging

Apache NetBeans binary zip

Anything else

zip file: genranges.zip

Are you willing to submit a pull request?

Yes. Done.

homberghp avatar May 26 '25 09:05 homberghp