indranilsarkar wrote:
I have a selenium test suite which is having two types of groups "sanity" and "All"
I want to run mvn command which will tell maven which group should be executed
Command could be like this : mvn -Dtest=sanity test
Any pointer?
You could use maven profiles and then run maven like this: mvn verify -P sanityTests
You would need to configure maven-surefire-plugin to include the Tests you want to run and exclude the ones you don't. Something like this i suppose:
<profiles>
<profile>
<id>sanityTests</id>
<properties>
<environment>development</environment>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!--
Exclude all integration tests so that they are not executed during
the test phase. This is because of a limitation in Maven 2.0.x which
only supports compiling a single test source tree. The
recommendation is to create a separate module for functional tests
as is done in the cargo-archetype-webapp-functional-test-module
-->
<excludes>
<exclude>**/it/**</exclude>
<exclude>**/selenium/**</exclude>
</excludes>
</configuration>
<executions>
<execution>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<!--
Include only integration tests so that they are executed during
the integration-test phase. Again this this is because of a
limitation in Maven 2.0.x which only supports compiling a single
test source tree. The recommendation is to create a separate
module for functional tests as is done in the
cargo-archetype-webapp-functional-test-module
-->
<excludes>
<exclude>none</exclude>
</excludes>
<includes>
<include>**/it/**</include>
<include>**/selenium/**</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>