Hello,
Here is some sample POM that exposes what could be done to separate
tests into different groups. Note that the same things could be done
using the <groups> tag for testNG. The interesting thing is that
execurtions can be merged (eg. mvn -Ptest1,test2 test) to group
several subgroups.

<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
  <modelVersion>4.0.0</modelVersion>
  <groupId>oqube.maven</groupId>
  <artifactId>multiple-test</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>
 <parent>
  <groupId>oqube.maven</groupId>
  <artifactId>maven-course</artifactId>
  <version>1-SNAPSHOT</version>  
 </parent>

   <build>
    <plugins>
     <plugin>
    <artifactId>maven-surefire-plugin</artifactId>
    <configuration>
     <!-- ensures no tests are run in default execution -->
     <includes>
      <include></include>
     </includes>
    </configuration>
     </plugin>
    </plugins>
   </build>

 <profiles>
  <profile>
   <id>test1</id>
   <build>
    <plugins>
     <plugin>
      <artifactId>maven-surefire-plugin</artifactId>
      <executions>
      <execution>
       <id>test1</id>
       <goals>
        <goal>test</goal>
       </goals>
       <configuration>
        <includes>
        <include>**/group1/*</include>
       </includes>
      </configuration>
      </execution>
      </executions>
     </plugin>
    </plugins>
   </build>
  </profile>
  
  <profile>
   <id>test2</id>
   <build>
    <plugins>
     <plugin>
      <artifactId>maven-surefire-plugin</artifactId>
      <executions>
      <execution>
       <id>test2</id>
       <goals>
        <goal>test</goal>
       </goals>
       <configuration>
        <includes>
        <include>**/group2/*</include>
       </includes>
      </configuration>
      </execution>
</executions>
     </plugin>
    </plugins>
   </build>
  </profile>
 </profiles>

</project>

I tried another solution redefining <testSourceDirectory> but it dose
not work when multiple profiles are selected. 
Another elegant solution would be to use maven-build-helper plugin to
add different source directoris according to selected profile.

HTH
-- 
OQube < software engineering \ génie logiciel >
Arnaud Bailly, Dr.
\web> http://www.oqube.com


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to