Author: jmitchell Date: Thu May 4 09:57:46 2006 New Revision: 399762 URL: http://svn.apache.org/viewcvs?rev=399762&view=rev Log: Initial stab at TestGen4Web maven plugin.
I still need to provide detailed instructions (ya, it's on my todo list :) ), but basically, just do this: - build and deploy the struts-blank.war sample app - cd to this dir - $mvn test You'll see the dependencies downloaded and the test generated and run. You'll also see the output as the test proceeds (assertions, etc), which is part of the underlying TestGen4Web sysouts. If you feel really adventurous, install that ff plugin into your own ff and record your own steps and save it to src/main/scripts and run the test again. Where I the most benefit with this new plugin is in doing 'smoke tests' of the same apps. This can be an invaluable time saver during releases (assuming people go out and create a bunch of scripts agains the apps. One more note, the actual plugin and pathes against the translator for TestGen4Web are not hosted here at Apache. The plugin itself can be used against any url, web or local, and any language (Java/Servlet, Java/JSF, PHP, Perl, whatever). Please give it a try. Thanks. Added: struts/action/trunk/integration/tg4w/ struts/action/trunk/integration/tg4w/pom.xml (with props) struts/action/trunk/integration/tg4w/src/ struts/action/trunk/integration/tg4w/src/main/ struts/action/trunk/integration/tg4w/src/main/java/ struts/action/trunk/integration/tg4w/src/main/scripts/ struts/action/trunk/integration/tg4w/src/main/scripts/blank-verify-welcome.xml (with props) struts/action/trunk/integration/tg4w/src/test/ struts/action/trunk/integration/tg4w/src/test/java/ Added: struts/action/trunk/integration/tg4w/pom.xml URL: http://svn.apache.org/viewcvs/struts/action/trunk/integration/tg4w/pom.xml?rev=399762&view=auto ============================================================================== --- struts/action/trunk/integration/tg4w/pom.xml (added) +++ struts/action/trunk/integration/tg4w/pom.xml Thu May 4 09:57:46 2006 @@ -0,0 +1,95 @@ +<?xml version="1.0"?> +<!-- +/* + * Copyright 2005-2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * $Id: pom.xml 397396 2006-04-27 04:59:35Z jmitchell $ + */ +--> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + <groupId>org.apache.struts.action</groupId> + <artifactId>struts-action-it-httpunit-taglib</artifactId> + <version>0.1-SNAPSHOT</version> + <packaging>jar</packaging> + <name>Struts Action - Taglib (HttpUnit) Tests</name> + + <build> + <sourceDirectory>src/main/java</sourceDirectory> + <testSourceDirectory>${project.build.directory}/generated-tests/tg4w-httpunit</testSourceDirectory> + + <plugins> + <plugin> + <groupId>net.sf.tools4java</groupId> + <artifactId>maven-testgen4web-plugin</artifactId> + <executions> + <execution> + <id>translate-and-compile-testgen4web-tests</id> + <phase>generate-test-sources</phase> + <configuration> + <scriptSourceDirectory>src/main/scripts/</scriptSourceDirectory> + <genSrcOutputDirectory>${project.build.directory}/generated-tests/tg4w-httpunit</genSrcOutputDirectory> + </configuration> + <goals> + <goal>testgen4web</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + </dependency> + + + <!-- + Not sure yet if this is needed. + --> + + <dependency> + <groupId>net.sf.tools4java</groupId> + <artifactId>maven-testgen4web-plugin</artifactId> + <version>0.1-SNAPSHOT</version> + </dependency> + + </dependencies> + + <reporting> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-report-plugin</artifactId> + </plugin> + </plugins> + </reporting> + + <pluginRepositories> + <pluginRepository> + <id>net.sf.tools4java</id> + <name>Tools4Java Maven Repository (TestGen4Web)</name> + <url>http://tools4java.sourceforge.net/m2/</url> + <releases><enabled>true</enabled></releases> + <snapshots><enabled>true</enabled></snapshots> + </pluginRepository> + </pluginRepositories> + +</project> Propchange: struts/action/trunk/integration/tg4w/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: struts/action/trunk/integration/tg4w/src/main/scripts/blank-verify-welcome.xml URL: http://svn.apache.org/viewcvs/struts/action/trunk/integration/tg4w/src/main/scripts/blank-verify-welcome.xml?rev=399762&view=auto ============================================================================== --- struts/action/trunk/integration/tg4w/src/main/scripts/blank-verify-welcome.xml (added) +++ struts/action/trunk/integration/tg4w/src/main/scripts/blank-verify-welcome.xml Thu May 4 09:57:46 2006 @@ -0,0 +1,21 @@ +<?xml version='1.0' encoding='UTF-8'?> +<tg4w version="0.38.1"> + <actions> + <action type="goto" refresh="true" step="0"> + <xpath><![CDATA[window.location.href]]></xpath> + <value><![CDATA[http://localhost:8080/struts-blank/Welcome.do]]></value> + </action> + <action type="verify-title" refresh="true" step="1"> + <xpath><![CDATA[*]]></xpath> + <value><![CDATA[Struts Blank Application]]></value> + </action> + <action type="verify-title" step="2"> + <xpath><![CDATA[*]]></xpath> + <value><![CDATA[Struts Blank Application]]></value> + </action> + <action type="assert-text-exists" step="3"> + <xpath><![CDATA[*]]></xpath> + <value><![CDATA[Welcome!]]></value> + </action> + </actions> +</tg4w> Propchange: struts/action/trunk/integration/tg4w/src/main/scripts/blank-verify-welcome.xml ------------------------------------------------------------------------------ svn:eol-style = native