Apache Tiles uses Selenium for functional testing of the example apps. The following example apps include Selenium tests:
Selenium is available in OpenQA's Maven repository, so no installation is necessary.
However, you may want to download the Selenium distribution (which includes the documentation) from http://www.openqa.org/selenium-core/download.action.
While you're there, also install the Firefox plugin Selenium IDE from http://www.openqa.org/selenium-ide/.
To run Selenium tests you need to add a configuration parameter in your settings.xml file.
<settings 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/xsd/settings-1.0.0.xsd"> ... <profiles> ... <profile> <id>run-selenium</id> <properties> <cargo.tomcat6x.home>/tomcat/installation/directory</cargo.tomcat6x.home> </properties> </profile> ... </profiles> </settings>
After that, if you have Firefox installed, you can launch Selenium tests in the command line:
mvn verity -Prun-selenium
Package the webapp with the 'selenium' profile activated.
The tiles-test pom includes a 'selenium' profile that will
mvn package -P selenium
The webapp will contain the following additional directories: 'selenium/core' and 'selenium/tests'.
Deploy the webapp to your favorite container. The Cargo plugin is configured to make this easy:
mvn package cargo:start -P selenium or mvn package cargo:start -P selenium -Dcargo.tomcat5x.home=/path/to/tomcat5
Run the tests with the Selenium TestRunner.
Run the tests automatically.
After it runs the tests automatically, Selenium can POST the results to a URL you supply. If you accept the default, and nothing is there to process the request, you will see a 404 Not Found error page in the bottom frame.
Edit an existing test, or write a new one.
If you add a new test, remember to add it to src/test/selenium/TestSuite.html so the TestRunner will find it.
The Selenium IDE Firefox plugin is the easiest way to edit tests. With the example app running, open the HTML file (src/test/selenium/TestSomething.html) from your svn checkout of Apache Tiles. Use the IDE to edit and run the test, and save your changes.
Note: Your changes will not be visible to the TestRunner in the deployed webapp unless you re-package and deploy it.