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

JUnit 5 run single test does not work for @ParameterizedTest, and go to source from test results doesn't work for these tests

    XMLWordPrintableJSON

Details

    Description

      In https://issues.apache.org/jira/browse/NETBEANS-6 some code was added that decides whether a code is a JUnit 5 test or not, by whether its annotation has @Testable
      as a "parent" (for lack of a better term). This is too conservative, @Testable is a meta-annotation and can appear anywhere in the parent hierarchy for test method annotations. For example, @ParameterizedTest has @TestTemplate as a parent, which has @Testable as a parent.

      The code should be updated to look through the entire annotation hierarchy to figure out if @Testable appears as a parent.

      Also when a @ParameterizedTest is run, and the test results window is used to go to the test method, the IDE throws an exception. This happens because the test name of a parameterized test is e.g. "myMethod

      {myParamType}

      [0]", rather than just "myMethod". The lookup code assumes that the test name will appear verbatim in the source.

      I think it makes sense to differentiate between the display name of a test method, and the actual method name. Adjusting org.netbeans.modules.gsf.testrunner.api.Testcase to allow this would let us fix this issue, while also making it easier to implement support for e.g. https://junit.org/junit5/docs/5.0.3/api/org/junit/jupiter/api/DisplayName.html at a later date.

      Attachments

        Issue Links

          Activity

            People

              srdo Stig Rohde Døssing
              srdo Stig Rohde Døssing
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m