Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

Using Selenium for functional testing of webapps, with Maven

The following profile comes from the parent pom for the Apache Shale example apps.

See this page for more information: http://shale.apache.org/shale-apps/selenium.html

With Maven 2.0.4, putting both plugin executions in the process-resources phase did not work-- they were executed in the wrong order and so the build failed as Selenium had not yet been unzipped when antrun tried to copy the files. Moving the dependency-maven-plugin execution to generate-sources fixed the problem, but this should not have been necessary. See http://www.nabble.com/Plugin-execution-ordering-within-a-phase-t2543138s177.html

<profile>
   <id>selenium</id>
   <activation>
      <property>
         <name>selenium</name>
      </property>
   </activation>
   <build>
      <plugins>
         <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>dependency-maven-plugin</artifactId>
            <executions>
               <execution>
                  <id>unzip-selenium</id>
                  <phase>generate-resources</phase>
                  <goals>
                     <goal>unpack</goal>
                  </goals>
                  <configuration>
                     <artifactItems>
                        <artifactItem>
                           <groupId>org.openqa.selenium.core</groupId>
                           <artifactId>selenium-core</artifactId>
                           <version>0.7.0</version>
                        </artifactItem>
                     </artifactItems>
                     <outputDirectory>${project.build.directory}/selenium</outputDirectory>
                  </configuration>
               </execution>
            </executions>
         </plugin>
         <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
               <execution>
                  <id>copy-selenium</id>
                  <phase>process-resources</phase>
                  <configuration>
                     <tasks>
                        <copy todir="${project.build.directory}/${artifactId}/selenium/core">
                           <fileset dir="${project.build.directory}/selenium/core"/>
                        </copy>
                        <copy todir="${project.build.directory}/${artifactId}/selenium/tests">
                           <fileset dir="${basedir}/src/test/selenium"/>
                        </copy>
                     </tasks>
                  </configuration>
                  <goals>
                     <goal>run</goal>
                  </goals>
               </execution>
            </executions>
         </plugin>
      </plugins>
   </build>
   <repositories>
      <repository>
         <id>OpenQA</id>
         <url>http://maven.openqa.org</url>
      </repository>
   </repositories>
</profile>


Using Selenium Maven Plugin and Cargo

Tutorial at Functional testing with Maven, Cargo and Selenium by Carlos Sanchez

Examples at Continuum web tests, Archiva web tests, and the Maven Web UI Tests.

  • No labels