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

Test failure with runOrder / class hierarchy / TestNG / @DirtiesContext

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Bug
    • 2.22.2, 3.0.0-M4
    • None
    • TestNG support
    • None

    Description

      Up front, I don't know if this is a Maven Surefire bug, or something in Spring (see https://github.com/spring-projects/spring-framework/issues/24685)

      <spring.version>5.2.4.RELEASE</spring.version>
      <testng.version>7.1.0</testng.version>
      <maven.compiler.target>1.8</maven.compiler.target>
      <maven.compiler.source>1.8</maven.compiler.source>
      <maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
      

      (Also reproduced with 3.0.0-M4)

      To reproduce: https://github.com/C-Otto/dirtiescontext

      I have a Spring, Maven, Java 8, TestNG setup where one test uses @DirtiesContext. In this VERY specific setup the test fails when I use mvn test. This seems to be related to the class names and the order in which tests are run.

      Notice that the class AbstractClassSomeUnrelatedTest does not serve any purpose, but has the same name prefix as the abstract test class. Changing the name to something else fixes the problem.

      Attachments

        Activity

          People

            tibordigana Tibor Digana
            C-Otto Carsten Otto
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: