Hello,
I have succeded in the integration of webtest-maven-plugin into AppFuse
2.0.2.
Below is the diff.
Beware, where it says 0.6.7-isigma, it means the trunk version of
webtest-maven-plugin from the cvs repo:
http://svn.codehaus.org/mojo/trunk/sandbox/webtest-maven-plugin
It seems the webtest-maven-plugin-0.6.7-SNAPSHOT.jar artifact available in
the maven repo is different from the one generated from a fresh checkout! I
renamed the version in my local installation to 0.6.7-isigma so there is no
mix-up.
If you don't use the fresh one, you will get an error:
Embedded error: import requires support in ProjectHelper
[INFO]
------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException:
...
With these, you can do a "mvn clean verify site" and you'll get a nice
Webtest report :-)
Beware, I have configured it so it does not fail if any webtest fails.
Cheers,
Josep
Diff:
diff -r 82ed445c829b pom.xml
--- a/pom.xml Fri Oct 29 18:36:06 2010 +0200
+++ b/pom.xml Fri Oct 29 18:52:38 2010 +0200
@@ -686,31 +686,19 @@
<reporting>
<plugins>
<plugin>
- <artifactId>maven-changes-plugin</artifactId>
- </plugin>
- <plugin>
- <artifactId>maven-checkstyle-plugin</artifactId>
+ <artifactId>maven-surefire-report-plugin</artifactId>
+ <reportSets>
+ <reportSet>
+ <reports>
+ <report>report-only</report>
+ </reports>
+ </reportSet>
+ </reportSets>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
- <artifactId>cobertura-maven-plugin</artifactId>
- <version>2.0</version>
- </plugin>
- <plugin>
- <artifactId>maven-javadoc-plugin</artifactId>
- </plugin>
- <plugin>
- <artifactId>maven-jxr-plugin</artifactId>
- </plugin>
- <plugin>
- <artifactId>maven-pmd-plugin</artifactId>
- <configuration>
- <linkXref>true</linkXref>
- <targetJdk>1.5</targetJdk>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-surefire-report-plugin</artifactId>
+ <artifactId>webtest-maven-plugin</artifactId>
+ <version>0.6.7-isigma</version>
</plugin>
</plugins>
</reporting>
@@ -733,7 +721,7 @@
<wait>${cargo.wait}</wait>
<container>
<containerId>${cargo.container}</containerId>
- <!--home>${cargo.container.home}</home-->
+ <type>${cargo.type}</type>
<zipUrlInstaller>
<url>${cargo.container.url}</url>
<installDir>${installDir}</installDir>
@@ -765,50 +753,37 @@
</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>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>webtest-maven-plugin</artifactId>
+ <version>0.6.7-isigma</version>
<executions>
<execution>
+ <id>webtest-test</id>
<phase>integration-test</phase>
<goals>
- <goal>run</goal>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <host>${cargo.host}</host>
+ <port>${cargo.port}</port>
+
<sourcedirectory>src/test/resources</sourcedirectory>
+ <sourcefile>web-tests.xml</sourcefile>
+ <target>run-all-tests</target>
+
<basepath>${project.build.finalName}</basepath>
+
<resultpath>target/webtest/webtest-results</resultpath>
+ <haltonfailure>false</haltonfailure>
+ <haltonerror>false</haltonerror>
+ <loglevel>error</loglevel>
+ </configuration>
+ </execution>
+ <execution>
+ <id>webtest-report</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>report</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>
diff -r 82ed445c829b src/test/resources/config.xml
--- a/src/test/resources/config.xml Fri Oct 29 18:36:06 2010 +0200
+++ b/src/test/resources/config.xml Fri Oct 29 18:52:38 2010 +0200
@@ -1,5 +1,16 @@
-<config host="${host}" port="${port}" protocol="http"
- basepath="${webapp.name}" resultpath="target/webtest-data"
saveresponse="true"
- resultfile="web-tests-result.xml" summary="true">
+<config
+ host="${host}"
+ port="${port}"
+ protocol="http"
+ basepath="${basepath}"
+ saveresponse="true"
+ haltonfailure="${haltonfailure}"
+ haltonerror="${haltonerror}"
+ resultpath="${resultpath}"
+ resultfile="web-tests-result.xml"
+ summary="true">
<header name="Accept-Language" value="${user.language}"/>
-</config>
\ No newline at end of file
+ <option name="ThrowExceptionOnScriptError" value="false"/>
+ <option name="ThrowExceptionOnFailingStatusCode" value="false"/>
+
+</config>
diff -r 82ed445c829b src/test/resources/web-tests.xml
--- a/src/test/resources/web-tests.xml Fri Oct 29 18:36:06 2010 +0200
+++ b/src/test/resources/web-tests.xml Fri Oct 29 18:52:38 2010 +0200
@@ -3,9 +3,10 @@
<!ENTITY login SYSTEM "./login.xml">
]>
<project basedir="." default="run-all-tests">
+ <taskdef resource="webtestTaskdefs.properties" />
<!-- Use i18n bundle, 2nd one listed is the default -->
- <property file="\${basedir}/target/${webapp.name
}/WEB-INF/classes/ApplicationResources_${user.language}.properties"/>
- <property file="\${basedir}/target/${webapp.name
}/WEB-INF/classes/ApplicationResources.properties"/>
+ <property
file="../../../target/classes/ApplicationResources_${user.language}.properties"/>
+ <property
file="../../../target/classes/ApplicationResources.properties"/>
<!-- runs all targets -->
<target name="run-all-tests"
@@ -215,7 +216,7 @@
<invoke description="click Upload a File link"
url="/uploadFile.html"/>
<verifytitle description="we should see file upload form"
text=".*${upload.title}.*" regex="true"/>
<setinputfield description="set name" name="name"
value="Canoo Test File"/>
- <setFileField description="set file" name="file"
fileName="pom.xml"/>
+ <setFileField description="set file" name="file"
fileName="../../../pom.xml"/>
<clickbutton label="${button.upload}" description="Click
Upload"/>
<verifytitle description="show file data if upload OK"
text=".*${display.title}.*" regex="true"/>
<verifytext description="verify original filename displayed
on page" text="pom.xml"/>
PieMailIsigma [image: isotipo isigma]
Josep García Corral
Ingeniero de Software
isigma, la referencia en firma electrónica
Tel. +34 932 387 108
www.isigma.es
[image: logotipo portasigma]
¡Prueba gratis la firma online! <http://www.portasigma.com>