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

Version 1 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.

<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</groupId>
                                    <artifactId>selenium-core</artifactId>
                                    <version>0.7.0</version>
                                    <type>zip</type>
                                </artifactItem>
                            </artifactItems>
                            <outputDirectory>${project.build.directory}</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-0.7.0/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>
</profile>
  • No labels