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

Phrased test names with missing @DisplayName result in a "null" test name

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.0.0-M7
    • 3.0.0-M8
    • Maven Surefire Plugin
    • None
    • All platforms

    Description

      If I enable phrased test naming in config, and then write a test such as the following:

      // Note no @DisplayName("...")
      class SomeTest {
        void fooHasThreeCharacters() {
          assertThat(foo).hasSize(3);
        }
      }
      

      ...then the console reports will contain a null name rather than something meaningful.

      I am proposing that when this phrased name is unavailable, Surefire should fall back to the original test name that would have been provided if phrased naming was disabled. The reasoning behind this is that showing an unformatted class name is more useful to the developer reading Maven logs than just the phrase null.

      Attachments

        1. example-reproduction.png
          132 kB
          Ashley Scopes

        Activity

          People

            sjaranowski Slawomir Jaranowski
            ascopes Ashley Scopes
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: