You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Jan-Christopher Bals <ja...@googlemail.com> on 2006/11/03 13:27:19 UTC

[m2] execute different testng suites in different phases

Hi folks!

I'm trying to execute TestNG Suites in different maven2 phases.

For that i defined two different testng.xml files

a) unit-tests.xml
b) integration-tests.xml

Now i want surefire to execute the unit-tests in the test phase and the 
integration-tests in the integration-test phase.

So i added the following lines to my pom:

<build>
...
  <plugins>

   <plugin>

    <artifactId>maven-surefire-plugin</artifactId>

    <configuration>

     <suiteXmlFiles>

      <suiteXmlFile>src/test/resources/unit-tests.xml</suiteXmlFile>

     </suiteXmlFiles>

    </configuration>

   </plugin>

   <plugin>

    <artifactId>maven-surefire-plugin</artifactId>

    <executions>

     <execution>

      <id>integration-test</id>

      <phase>integration-test</phase>

      <goals>

       <goal>test</goal>

      </goals>

      <configuration>

       <suiteXmlFiles>

        <suiteXmlFile>integration-tests.xml</suiteXmlFile> 


       </suiteXmlFiles>

      </configuration>

     </execution>

    </executions>

   </plugin>

  </plugins>
    ...
</build>

When i run 'mvn test' surefire executes the unit tests as desired.
But when i run 'mvn integration-test' surefire does not execute the 
integration-tests in the integration-phase. Instead of that it runs the 
unit-tests a second time!


Does anybody know how to execute testng suites in different maven phases?

best regards
Jan

P.S.

<build>
...
  <plugins>
   <plugin>
    <artifactId>maven-surefire-plugin</artifactId>
    <executions>
     <execution>
      <id>test</id>
      <phase>test</phase>
      <goals>
       <goal>test</goal>
      </goals>
      <configuration>
       <suiteXmlFiles>
        <suiteXmlFile>unit-tests.xml</suiteXmlFile>
       </suiteXmlFiles>
      </configuration>
     </execution>
     <execution>
      <id>integration-test</id>
      <phase>integration-test</phase>
      <goals>
       <goal>test</goal>
      </goals>
      <configuration>
       <suiteXmlFiles>
        <suiteXmlFile>integration-tests.xml</suiteXmlFile> 

       </suiteXmlFiles>
      </configuration>
     </execution>

    </executions>
   </plugin>
  </plugins>
    ...
</build>

This does not work, too. In this case surefire runs the unit and the 
integration tests in the test phase, which is even worse for me.




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org