[
https://issues.apache.org/jira/browse/NETBEANS-1500?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16698185#comment-16698185
]
Stig Rohde Døssing commented on NETBEANS-1500:
----------------------------------------------
I think there are two issues here, at least with regard to running these in a
Maven project. One is that Surefire doesn't pick up @Nested inner classes in
test classes when running mvn test -Dtest=testClass. It looks like there's an
issue tracking it here https://github.com/junit-team/junit5/issues/1343.
The second issue is that when you try to test a single method in Netbeans
(Run/Debug Focused Test Method), Netbeans assumes that the method is in the
outermost class in the file. So for example, if you try to run inner1Test in
your example, Netbeans will do mvn test -Dtest=TopLevelTest#inner1Test, instead
of mvn test -Dtest=TopLevelTest$InnerTest#inner1Test.
I'll raise a subtask for the second issue.
> JUnit 5 there is no posibilities how run Nested test class
> ----------------------------------------------------------
>
> Key: NETBEANS-1500
> URL: https://issues.apache.org/jira/browse/NETBEANS-1500
> Project: NetBeans
> Issue Type: Improvement
> Components: java - JUnit
> Affects Versions: 10.0
> Reporter: Tomáš Poledný
> Priority: Trivial
>
> JUnit 5 has [Nested
> test|https://junit.org/junit5/docs/current/user-guide/#writing-tests-nested].
> Nested test is inner class with annotation @Nested. There is no posibilities
> how run nested test (only one method with Run Focused Test Method). Test
> methods from top level class are running after Test File only.
> Example:
> {code:java}
> class TopLevelTest {
> @Test
> void topLevelTest() {
> System.out.println("topLevelTest");
> }
> @Nested
> class InnerTest {
> @Test
> void inner1Test() {
> System.out.println("Inner 1");
> }
> @Test
> void inner2Test() {
> System.out.println("Inner 2");
> }
> }
> }
> {code}
> I am not able to run whole InnerTest class.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists