This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 269372 - Run single inherited test doesn't work with JUnit 5 + Maven
Summary: Run single inherited test doesn't work with JUnit 5 + Maven
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: JUnit (show other bugs)
Version: 8.2
Hardware: PC Other
: P3 normal with 2 votes (vote)
Assignee: Theofanis Oikonomou
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-16 19:50 UTC by Leperous
Modified: 2016-12-16 19:51 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Leperous 2016-12-16 19:50:25 UTC
If I have these classes:

abstract class FooTest { @Test public void foo() {} }
class BarTest extends Foo { @Test public void bar() {} }

In JUnit 4 I can run the "foo" test as a standalone method from the test window, as the concrete class BarTest is passed to Surefire ("-Dtest=Bar#foo").

In JUnit 5 the abstract superclass Foo is passed to surefire("-Dtest=Foo#foo") which cannot be instantiated and so cannot run. This occurs regardless of whether FooTest is abstract, concrete or an interface.

Is it possible to tighten the logic that determines which class to pass to Surefire without having to wait for fully fledged JUnit 5 support? (Which actually seems to work perfectly fine, apart from Netbeans occasionally trying to re-add JUnit 4 to my dependencies.)
Comment 1 Leperous 2016-12-16 19:51:23 UTC
Excuse the typos where I forgot to add *Test to some of the class names, but it should be easy to figure out what I mean.