1

I have a set of integration tests which I need to run in specific order. So i created a BlahSuite.java inside the same package, and specified the order of classes there. And annotation as following

@RunWith(Suite.class)
@Suite.SuiteClasses({

And I added the plugin into pom as following

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-failsafe-plugin</artifactId>
    <version>2.9</version>
    <configuration>
      <includes>
        <include>**/*Suite.java</include>
      </includes>
    </configuration>
    <executions>
      <execution>
        <id>integration-test</id>
        <goals>
          <goal>integration-test</goal>
        </goals>
      </execution>
      <execution>
        <id>verify</id>
        <goals>
          <goal>verify</goal>
        </goals>
      </execution>
    </executions>
</plugin>

But still the tests are fired in different orders, feels like the Suite class is fully ignored. Any idea how to fix this ?

Tunaki
  • 132,869
  • 46
  • 340
  • 423
dinesh707
  • 12,106
  • 22
  • 84
  • 134

1 Answers1

0

I found the answer at Stackoverflow question Run Junit Suite using Maven Command

So what my final setup is I just removed failsafe plugin and added following,

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-surefire-plugin</artifactId>
  <configuration>
  <includes>
    <include>**/*Suite.class</include>
  </includes>
  </configuration>
</plugin>
Community
  • 1
  • 1
dinesh707
  • 12,106
  • 22
  • 84
  • 134