Uploaded image for project: 'Maven Surefire'
  1. Maven Surefire
  2. SUREFIRE-2152

Allow to show name (not just index) of parameterized tests in console output

    XMLWordPrintableJSON

Details

    Description

      When running parameterized tests with surefire (JUnit5 in my case), it can be tough to easily figure out which exact instances have failed, based on the console output. While I can - at least in some places in the console output (see also SUREFIRE-2151) - see the invocation ID of a failing test, I would generally also want to see the name of the failing parameters in question along with that (i.e. a representation of the actual arguments of the invocation, possibly customized by a developer with @ParameterizedTest(name="..."))

      Especially for parameterized tests with large amounts of invocations, and/or where those actual arguments are only defined at runtime (e.g. via JUnit5 @MethodSource), it can beĀ  very cumbersome to identify which precise instance caused a failure, based on the numeric invocation-ID alone.

      I have tried the different configurations introduced in 3.0.0-M4 (i.e. the ones described in https://maven.apache.org/surefire/maven-surefire-plugin/examples/junit-platform.html#surefire-extensions-and-reports-configuration-for-displayname / introduced with SUREFIRE-1546), but none of them seem to really change anything regarding the console reporting.

      So I would appreciate having the possibility (ideally with another configuration flag) to include the name of templated-tests such as @ParameterizedTest (in addition to the invocation-ID) along when creating the test-name. Note that I am not really interested in any @DisplayName annotations (which is what SUREFIRE-1546 covered) - to me this is mainly about making it as easy as possible for developers to quickly identify which invocation caused a failure.

      I did actually prepare a patched surefire version that we have in use for this (albeit without a configuration flag to control this behavior, don't know how to do that). If that's something worth sharing, I'm happy to create a PR for it.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              rweires Ralph Weires
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: