Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-6041

Go To Source and test-results view broken with JUnit5 @Nested

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 12.4, 12.5
    • None
    • None
    • Manjaro Linux, kernel 5.14.2

      Netbeans 12.5

       

    Description

      Given a test case like:

      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();
            }
          }
        }
      }
      
      

      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)

      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.

      Attachments

        1. image-2021-09-21-19-12-29-711.png
          24 kB
          Ratcash Developer

        Activity

          People

            lkishalmi Laszlo Kishalmi
            ratcashdev Ratcash Developer
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: