You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by "Ratcash Developer (Jira)" <ji...@apache.org> on 2021/09/24 06:16:00 UTC

[jira] [Commented] (NETBEANS-6041) Go To Source and test-results view broken with JUnit5 @Nested

    [ https://issues.apache.org/jira/browse/NETBEANS-6041?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17419589#comment-17419589 ] 

Ratcash Developer commented on NETBEANS-6041:
---------------------------------------------

I will submit a PR for the "Go To Source" (#1), and maybe also for #3.

#2 (tests not appearing in the Test Results window) is a more complicated issue. The whole testrunner support is made with the assumption that test suites are executed sequentially. This, unfortunately is not true with nested tests, where the execution may look like
 * A$B.method1
 * A.method2
 * A$B.method3
 * A.method4

Fixing this needs significant changes to TestSession and TestProgressListener which assume that only one suite can be running at any given time.

It works somewhat if tests are only on equal level, e.g.
 * A$B.method1
 * A$B.method2
 * A$C.method3
 * A$C.method4

If there was a method directly on A, like A.otherMethod, then the results would not be shown again.

> Go To Source and test-results view broken with JUnit5 @Nested
> -------------------------------------------------------------
>
>                 Key: NETBEANS-6041
>                 URL: https://issues.apache.org/jira/browse/NETBEANS-6041
>             Project: NetBeans
>          Issue Type: Bug
>          Components: projects - Gradle, projects - Maven
>    Affects Versions: 12.4, 12.5
>         Environment: Manjaro Linux, kernel 5.14.2
> Netbeans 12.5
>  
>            Reporter: Ratcash Developer
>            Assignee: Laszlo Kishalmi
>            Priority: Major
>         Attachments: image-2021-09-21-19-12-29-711.png
>
>
> Given a test case like:
> {code:java}
> import org.junit.jupiter.api.Nested;
> import org.junit.jupiter.api.Test;
> public class SampleTest {
>   @Test
>   public void testMyMethod1() {
>     System.out.println("write this");
>   }
>   @Nested
>   class NestedClass {
>     @Test
>     public void testMyMethod2() {
>       System.out.println("nested write 2");
>     }
>   }
>   @Nested
>   class NestedClass2 {
>     @Test
>     public void testMyMethod1() {
>       System.out.println("nested write 1");
>     }
>     @Test
>     public void testMyMethod3() {
>       System.out.println("nested write 3");
>     }
>     @Nested
>     class DoubleNestedClass3 {
>       @Test
>       public void testMyMethod4() {
>         System.out.println("double nested write 4");
>       }
>       @Test
>       public void testNextedException() throws Exception {
>         throw new Exception();
>       }
>     }
>   }
> }
> {code}
> A couple of issues with such tests:
>  
> 1. The "Test Results" window shows only some of the executed tests (in this specific case only 3)
> !image-2021-09-21-19-12-29-711.png!
> 2. the "Go to source" function does not work even for the test cases that are shown. 
> 3. using the "Run focused test method" does not work - a bad combo of class and method is provided to the test runner.
> Clearly, part of this is caused by the $ClassName in the test classname, which is not correctly processed by the `Location` class.
> Netbean's own navigator is able to navigate such classes, so this should be supported by the Finder, but I was not able to figure out the right way to do so.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists