Hi, here's the configuration I use to run groovy Canoo Webtest 3.0 as
integration test through the Maven lifecycle.
I use TestNG to make the tests part of a more global test suite, it should
be quite similar with JUnit.
The integration tests, Java and/or Groovy, have to be put in a specific
directory, so as to keep them separated from the unit tests.
I put them in src/it (src/it/groovy, src/it/java, src/it/resources).
<!-- plugin to configure jetty to run before and stop after the
integration-test phase -->
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<configuration>
<connectors>
<connector
implementation="org.mortbay.jetty.nio.SelectChannelConnector">
<port>8080</port>
<maxIdleTime>60000</maxIdleTime>
</connector>
</connectors>
<!-- below for integration test only -->
<stopPort>8005</stopPort>
<stopKey>STOP</stopKey>
</configuration>
<executions>
<execution>
<id>start-jetty</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<scanIntervalSeconds>0</scanIntervalSeconds>
<daemon>true</daemon>
</configuration>
</execution>
<execution>
<id>stop-jetty</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- failsafe is similar to surefire but made specifically to
handle integration tests -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>failsafe-maven-plugin</artifactId>
<version>2.4.3-alpha-1</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/it/testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
<executions>
<execution>
<id>integration-test</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
<execution>
<id>verify</id>
<phase>verify</phase>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- groovy support: only compiles groovy classes found in
src/it/groovy to test-classes -->
<plugin>
<groupId>org.codehaus.groovy.maven
</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<goals>
<goal>testCompile</goal>
</goals>
<configuration>
<sources>
<fileset>
<directory>src/it/groovy</directory>
<includes>
<include>**/*.groovy</include>
</includes>
</fileset>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<!-- add more Java test sources to the configuration -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>add-test-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>src/it/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
additional dependencies needed:
<dependency>
<groupId>com.canoo.webtest</groupId>
<artifactId>webtest</artifactId>
<version>3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.groovy.maven.runtime</groupId>
<artifactId>gmaven-runtime-default</artifactId>
<version>1.0-rc-3</version>
<scope>test</scope>
</dependency>
With this config in your Maven project's pom, the Canoo webtests will be run
during the integration-test phase.
To get your test run you have to provide a testng.xml file that matches your
test file only (and not your unit test files), a specific group name for
instance.
You can run them manually using 'mvn integration-test'.
It will run the unit test first, start jetty, run the Canoo integration
tests against it, close jetty.
I can't say much about the reporting yet, but it should be handled properly.
The only problem remaining (so far) is that the option to disable Webtest
console -Dwt.headless
doesn't work with the integration-test phase.
What are the solutions today to avoid running the Console?
HTH someone.
--
View this message in context:
http://old.nabble.com/Maven-configuration-to-run-Webtest-3.0-groovy-test-integration-test-tp26385482p26385482.html
Sent from the WebTest mailing list archive at Nabble.com.
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest