I'm using the <salenese> Ant task to run some Selenium tests in my project. I want tests to run in Firefox on all platforms, and Firefox and IE when running on Windows. I've got everything working using the XML below, but it's quite verbose. Is there a way to simplify, or is this the recommended strategy?
<profiles>
<profile>
<id>${cargo.container}</id>
<activation>
<property>
<name>!maven.test.skip</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>0.2</version>
...
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>launch-selenium</id>
<phase>integration-test</phase>
<configuration>
<tasks>
<taskdef resource="selenium-ant.properties">
<classpath refid="maven.plugin.classpath"/>
</taskdef>
<selenese suite="src/test/resources/selenium/TestSuite.html"
browser="*firefox" timeoutInSeconds="180"
results="${project.build.directory}/selenium-firefox-results.html"
startURL="
http://${cargo.host}:${cargo.port}/${project.build.finalName}/"/>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-nodeps</artifactId>
<version>1.6.5</version>
</dependency>
<dependency>
<groupId>org.openqa.selenium.server</groupId>
<artifactId>selenium-server</artifactId>
<version>0.9.1-SNAPSHOT</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>windows</id>
<activation>
<os>
<family>Windows</family>
</os>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>launch-selenium</id>
<phase>integration-test</phase>
<configuration>
<tasks>
<taskdef resource="selenium-ant.properties">
<classpath refid="maven.plugin.classpath"/>
</taskdef>
<selenese suite="src/test/resources/selenium/TestSuite.html"
browser="*firefox" timeoutInSeconds="180"
results="${project.build.directory}/selenium-firefox-results.html"
startURL="
http://${cargo.host}:${cargo.port}/${project.build.finalName}/"/>
<selenese suite="src/test/resources/selenium/TestSuite.html"
browser="*iexplore" timeoutInSeconds="180"
results="${project.build.directory}/selenium-ie-results.html"
startURL="
http://${cargo.host}:${cargo.port}/${project.build.finalName}/"/>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
Thanks,
Matt