I tried this but I am blocked, apparently by an ant-related error, something
about problems with the Canoo includes.
This is the relevant pom section:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>0.3</version>
<configuration>
<wait>${cargo.wait}</wait>
<container>
<containerId>${cargo.container}</containerId>
<type>${cargo.type}</type>
<!--home>${cargo.container.home}</home-->
<zipUrlInstaller>
<url>${cargo.container.url}</url>
<installDir>${installDir}</installDir>
</zipUrlInstaller>
</container>
<configuration>
<home>${project.build.directory}/${cargo.container}/container</home>
<properties>
<cargo.hostname>${cargo.host}</cargo.hostname>
<cargo.servlet.port>${cargo.port}</cargo.servlet.port>
</properties>
</configuration>
</configuration>
<executions>
<execution>
<id>start-container</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop-container</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>webtest-maven-plugin</artifactId>
<executions>
<execution>
<id>webtest-test</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<host>${cargo.host}</host>
<port>${cargo.port}</port>
<sourcedirectory>target/test-classes</sourcedirectory>
<sourcefile>web-tests.xml</sourcefile>
<haltonfailure>false</haltonfailure>
<haltonerror>false</haltonerror>
<loglevel>warn</loglevel>
</configuration>
</execution>
<execution>
<id>webtest-report</id>
<phase>post-integration-test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
And this is the error:
[INFO] [talledLocalContainer] 17-sep-2010 18:24:09
org.apache.catalina.startup.HostConfig deployWAR
[INFO] [talledLocalContainer] INFO: Despliegue del archivo cargocpc.war de
la aplicaci¾n web
[INFO] [talledLocalContainer] 17-sep-2010 18:24:09
org.apache.coyote.http11.Http11BaseProtocol start
[INFO] [talledLocalContainer] INFO: Arrancando Coyote HTTP/1.1 en puerto
http-8081
[INFO] [talledLocalContainer] 17-sep-2010 18:24:09
org.apache.catalina.startup.Catalina start
[INFO] [talledLocalContainer] INFO: Server startup in 10040 ms
[INFO] [talledLocalContainer] Tomcat 5.5.30 started on port [8081]
[INFO] [webtest:test {execution: webtest-test}]
[INFO] Executing
E:\Projects\portasigma\modular\portasigma-web\target\test-classes\web-tests.xml
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
[INFO] Executing
E:\Projects\portasigma\modular\portasigma-web\target\test-classes\web-tests.xml
failed
Embedded error: import requires support in ProjectHelper
[INFO]
------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Executing
E:\Projects\portasigma\modular\portasigma-web\target\test-classes
web-tests.xml failed
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at
org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at
org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Executing
E:\Projects\portasigma\modular\portasigma-web\target\test-class
es\web-tests.xml failed
at
org.codehaus.mojo.webtest.WebtestTestMojo.execute(WebtestTestMojo.java:64)
at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
... 17 more
Caused by:
E:\Projects\portasigma\modular\portasigma-web\target\test-classes\web-tests.xml:21:
import requires support in ProjectHel
per
at
org.apache.tools.ant.taskdefs.ImportTask.execute(ImportTask.java:100)
at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at
org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:140)
at
org.codehaus.mojo.webtest.components.AntExecutor.<init>(AntExecutor.java:65)
at
org.codehaus.mojo.webtest.WebtestTestMojo.execute(WebtestTestMojo.java:59)
... 19 more
2010/9/17 Matt Raible <[email protected]>
> I've been meaning to integrate the webtest-maven-plugin for quite some
> time, just haven't got around to it. You might try it.
>
> http://mojo.codehaus.org/webtest-maven-plugin/
>
> Please let me know if you get it to work.
>
> Matt
>
> On Sep 17, 2010, at 10:09 AM, Josep García wrote:
>
> We currently use Appfuse 2.0.2.
> In our pom we have an integration-test profile which runs Canoo webtests.
> See below.
> How can we add generation of the Canoo webtest reports and include in the
> maven site generation?
>
> <profile>
> <id>integration-test</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.3</version>
> <configuration>
> <wait>${cargo.wait}</wait>
> <container>
>
> <containerId>${cargo.container}</containerId>
> <!--home>${cargo.container.home}</home-->
> <zipUrlInstaller>
> <url>${cargo.container.url}</url>
> <installDir>${installDir}</installDir>
> </zipUrlInstaller>
> </container>
> <configuration>
>
> <home>${project.build.directory}/${cargo.container}/container</home>
> <properties>
>
> <cargo.hostname>${cargo.host}</cargo.hostname>
>
> <cargo.servlet.port>${cargo.port}</cargo.servlet.port>
> </properties>
> </configuration>
> </configuration>
> <executions>
> <execution>
> <id>start-container</id>
> <phase>pre-integration-test</phase>
> <goals>
> <goal>start</goal>
> </goals>
> </execution>
> <execution>
> <id>stop-container</id>
> <phase>post-integration-test</phase>
> <goals>
> <goal>stop</goal>
> </goals>
> </execution>
> </executions>
> </plugin>
> <plugin>
> <artifactId>maven-antrun-plugin</artifactId>
> <version>1.1</version>
> <configuration>
> <tasks>
> <taskdef
> resource="webtest_base_relaxed.taskdef">
> <classpath
> refid="maven.test.classpath"/>
> </taskdef>
> <mkdir dir="target/webtest-data"/>
> <!-- Delete old results file if it exists
> -->
> <delete
> file="target/webtest-data/web-tests-result.xml"/>
> <!-- This is so the default will be used if
> no test case is specified -->
> <property name="test"
> value="run-all-tests"/>
> <echo level="info">Testing
> '${project.build.finalName}' with locale '${user.language}'
> </echo>
> <ant
> antfile="src/test/resources/web-tests.xml" target="${test}">
> <property name="user.language"
> value="${user.language}"/>
> <property name="webapp.name"
> value="${project.build.finalName}"/>
> <property name="host"
> value="${cargo.host}"/>
> <property name="port"
> value="${cargo.port}"/>
> </ant>
> </tasks>
> </configuration>
> <executions>
> <execution>
> <phase>integration-test</phase>
> <goals>
> <goal>run</goal>
> </goals>
> </execution>
> </executions>
> <dependencies>
> <dependency>
> <groupId>com.canoo.webtest</groupId>
> <artifactId>webtest</artifactId>
> <version>${webtest.version}</version>
> <!-- groovy-all doesn't have a pom in
> central repo -->
> <!-- exclude groovy to prevent trying to
> fetch pom -->
> <exclusions>
> <exclusion>
> <groupId>groovy</groupId>
> <artifactId>groovy-all</artifactId>
> </exclusion>
> </exclusions>
> </dependency>
> </dependencies>
> </plugin>
> </plugins>
> </build>
> </profile>
>
> Josep
>
>
>