Author: wsmoak
Date: Mon Jul 31 18:21:09 2006
New Revision: 427397
URL: http://svn.apache.org/viewvc?rev=427397&view=rev
Log:
Added configuration for Selenium and some simple tests for the Mailreader app.
Added a menu item and information on installing Selenium and running the tests
to the shale-apps site.
SHALE-243
Added:
shale/framework/trunk/shale-apps/shale-mailreader/src/test/selenium/
shale/framework/trunk/shale-apps/shale-mailreader/src/test/selenium/TestCreateNew.html
(with props)
shale/framework/trunk/shale-apps/shale-mailreader/src/test/selenium/TestRegistration.html
(with props)
shale/framework/trunk/shale-apps/shale-mailreader/src/test/selenium/TestSuite.html
(with props)
shale/framework/trunk/shale-apps/src/site/apt/
shale/framework/trunk/shale-apps/src/site/apt/selenium.apt (with props)
Modified:
shale/framework/trunk/shale-apps/pom.xml
shale/framework/trunk/shale-apps/src/site/site.xml
Modified: shale/framework/trunk/shale-apps/pom.xml
URL:
http://svn.apache.org/viewvc/shale/framework/trunk/shale-apps/pom.xml?rev=427397&r1=427396&r2=427397&view=diff
==============================================================================
--- shale/framework/trunk/shale-apps/pom.xml (original)
+++ shale/framework/trunk/shale-apps/pom.xml Mon Jul 31 18:21:09 2006
@@ -63,6 +63,62 @@
<module>shale-sql-browser</module>
</modules>
</profile>
+
+ <!-- See http://shale.apache.org/shale-apps/selenium.html -->
+ <profile>
+ <id>selenium</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>dependency-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unzip-selenium</id>
+ <phase>process-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>
+
</profiles>
<modules>
Added:
shale/framework/trunk/shale-apps/shale-mailreader/src/test/selenium/TestCreateNew.html
URL:
http://svn.apache.org/viewvc/shale/framework/trunk/shale-apps/shale-mailreader/src/test/selenium/TestCreateNew.html?rev=427397&view=auto
==============================================================================
---
shale/framework/trunk/shale-apps/shale-mailreader/src/test/selenium/TestCreateNew.html
(added)
+++
shale/framework/trunk/shale-apps/shale-mailreader/src/test/selenium/TestCreateNew.html
Mon Jul 31 18:21:09 2006
@@ -0,0 +1,118 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Create New Subscription Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">Create New Subscription Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>http://localhost:8080/shale-mailreader/</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>link=Register with the MailReader Demonstration Application</td>
+ <td></td>
+</tr>
+<tr>
+ <td>storeEval</td>
+ <td> 'user' + (new Date().getTime()) </td>
+ <td>userid</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>registration:username</td>
+ <td>${userid}</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>registration:password</td>
+ <td>pass</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>registration:password2</td>
+ <td>pass</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>registration:fullName</td>
+ <td>Ima User</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>registration:fromAddress</td>
+ <td>[EMAIL PROTECTED]</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>registration:submit</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertTitle</td>
+ <td>MailReader Demonstration Application - Main Menu</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertTextPresent</td>
+ <td>Main Menu Options for ${userid}</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>link=Edit your user registration profile</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>registration:create</td>
+ <td></td>
+</tr>
+<tr>
+ <td>storeEval</td>
+ <td>'pop.example.net'</td>
+ <td>hostname</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>subscription:host</td>
+ <td>${hostname}</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>subscription:username</td>
+ <td>abc</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>subscription:password</td>
+ <td>def</td>
+</tr>
+<tr>
+ <td>select</td>
+ <td>subscription:type</td>
+ <td>label=POP3 Protocol</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>subscription:save</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertTextPresent</td>
+ <td>Host Name</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertTextPresent</td>
+ <td>${hostname}</td>
+ <td></td>
+</tr>
+</tbody></table>
+</body>
+</html>
Propchange:
shale/framework/trunk/shale-apps/shale-mailreader/src/test/selenium/TestCreateNew.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
shale/framework/trunk/shale-apps/shale-mailreader/src/test/selenium/TestCreateNew.html
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added:
shale/framework/trunk/shale-apps/shale-mailreader/src/test/selenium/TestRegistration.html
URL:
http://svn.apache.org/viewvc/shale/framework/trunk/shale-apps/shale-mailreader/src/test/selenium/TestRegistration.html?rev=427397&view=auto
==============================================================================
---
shale/framework/trunk/shale-apps/shale-mailreader/src/test/selenium/TestRegistration.html
(added)
+++
shale/framework/trunk/shale-apps/shale-mailreader/src/test/selenium/TestRegistration.html
Mon Jul 31 18:21:09 2006
@@ -0,0 +1,68 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Registration Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">Registration Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>http://localhost:8080/shale-mailreader/</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>link=Register with the MailReader Demonstration Application</td>
+ <td></td>
+</tr>
+<tr>
+ <td>storeEval</td>
+ <td> 'user' + (new Date().getTime()) </td>
+ <td>userid</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>registration:username</td>
+ <td>${userid}</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>registration:password</td>
+ <td>pass</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>registration:password2</td>
+ <td>pass</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>registration:fullName</td>
+ <td>Ima User</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>registration:fromAddress</td>
+ <td>[EMAIL PROTECTED]</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>registration:submit</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertTitle</td>
+ <td>MailReader Demonstration Application - Main Menu</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertTextPresent</td>
+ <td>Main Menu Options for ${userid}</td>
+ <td></td>
+</tr>
+</tbody></table>
+</body>
+</html>
Propchange:
shale/framework/trunk/shale-apps/shale-mailreader/src/test/selenium/TestRegistration.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
shale/framework/trunk/shale-apps/shale-mailreader/src/test/selenium/TestRegistration.html
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added:
shale/framework/trunk/shale-apps/shale-mailreader/src/test/selenium/TestSuite.html
URL:
http://svn.apache.org/viewvc/shale/framework/trunk/shale-apps/shale-mailreader/src/test/selenium/TestSuite.html?rev=427397&view=auto
==============================================================================
---
shale/framework/trunk/shale-apps/shale-mailreader/src/test/selenium/TestSuite.html
(added)
+++
shale/framework/trunk/shale-apps/shale-mailreader/src/test/selenium/TestSuite.html
Mon Jul 31 18:21:09 2006
@@ -0,0 +1,16 @@
+<html>
+<body>
+
+<table>
+ <tr>
+ <td>Mailreader Tests</td>
+ </tr>
+ <tr>
+ <td><a href="TestRegistration.html">Registration Test</a></td>
+ </tr>
+ <tr>
+ <td><a href="TestCreateNew.html">Create New Subscription Test</a></td>
+ </tr>
+</table>
+</body>
+</html>
\ No newline at end of file
Propchange:
shale/framework/trunk/shale-apps/shale-mailreader/src/test/selenium/TestSuite.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
shale/framework/trunk/shale-apps/shale-mailreader/src/test/selenium/TestSuite.html
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: shale/framework/trunk/shale-apps/src/site/apt/selenium.apt
URL:
http://svn.apache.org/viewvc/shale/framework/trunk/shale-apps/src/site/apt/selenium.apt?rev=427397&view=auto
==============================================================================
--- shale/framework/trunk/shale-apps/src/site/apt/selenium.apt (added)
+++ shale/framework/trunk/shale-apps/src/site/apt/selenium.apt Mon Jul 31
18:21:09 2006
@@ -0,0 +1,111 @@
+ -----------
+ Selenium Testing
+ -----------
+
+Selenium Testing
+
+ <<{{{http://selenium.openqa.org}Selenium}}>> is a test tool for web
+ applications. Unlike HtmlUnit or HttpUnit tests which <simulate> a browser,
+ Selenium tests run directly in a real browser such as Firefox or Internet
+ Explorer. The Selenium JavaScript code is deployed alongside your running
+ application, and interacts with it just as your users do.
+
+ Shale uses Selenium to for functional testing of the example apps.
+ The following example apps include Selenium tests:
+
+ * Shale Mailreader
+
+* Install
+
+ <<Download>> Selenium 0.7.0 from OpenQA, and install selenium-core-0.7.0.zip
+ in your local Maven repository.
+
+ {{{http://www.openqa.org/selenium-core/download.action}
+ http://www.openqa.org/selenium-core/download.action}}
+
++-----+
+mvn install:install-file -DgroupId=org.openqa -DartifactId=selenium-core \
+ -Dversion=0.7.0 -Dpackaging=zip -DgeneratePom=true \
+ -Dfile=/path/to/selenium-core-0.7.0.zip
++-----+
+
+ TODO: Is this available in a Maven repository?
+
+ While you're there, also install the Firefox plugin <<Selenium IDE>> from
+ {{{http://www.openqa.org/selenium-ide/}
+ http://www.openqa.org/selenium-ide/}}.
+
+* Package
+
+ <<Package>> the webapp with the 'selenium' profile activated.
+
+ The {{{http://svn.apache.org/viewvc/shale/framework/trunk/shale-apps/pom.xml
+?view=markup}shale-apps-parent pom}} includes a 'selenium' profile that will
+
+ * unzip the Selenium distribution under 'target'
+
+ * copy the 'core' directory from the unzipped Selenium distribution into the
+ webapp
+
+ * copy any files in 'src/test/selenium' into the webapp
+
+ []
+
++-----+
+mvn package -P selenium
++-----+
+
+ The webapp will contain the following additional directories: 'selenium/core'
+ and 'selenium/tests'.
+
+* Deploy
+
+ <<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
+
+ <<Run>> the tests with the Selenium TestRunner.
+
+ * Visit http://localhost:8080/<appname>/selenium/core/TestRunner.html
+
+ * Click 'go' in the top left frame to load the TestSuite.html page
+
+ * Click 'All' in the top right frame to run the tests
+
+
+* Edit
+
+ <<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.
+
+** Selenium IDE
+
+ 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 Shale. 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.
+
+** HTML Editor
+
+ Selenium tests are written in plain HTML tables, so you may edit them with
any
+ text editor.
+
+ If you prefer to edit the tests 'in place' in the running webapp, simply copy
+ the files back to your svn checkout directory and commit the changes.
+
+
Propchange: shale/framework/trunk/shale-apps/src/site/apt/selenium.apt
------------------------------------------------------------------------------
svn:eol-style = native
Modified: shale/framework/trunk/shale-apps/src/site/site.xml
URL:
http://svn.apache.org/viewvc/shale/framework/trunk/shale-apps/src/site/site.xml?rev=427397&r1=427396&r2=427397&view=diff
==============================================================================
--- shale/framework/trunk/shale-apps/src/site/site.xml (original)
+++ shale/framework/trunk/shale-apps/src/site/site.xml Mon Jul 31 18:21:09 2006
@@ -32,8 +32,12 @@
<item name="SQL Browser"
href="../shale-apps/shale-sql-browser/index.html"/>
<item name="Use Cases"
href="../shale-apps/shale-usecases/index.html"/>
</menu>
-
- ${reports}
+
+ <menu name="Testing">
+ <item name="OpenQA Selenium" href="/selenium.html"/>
+ </menu>
+
+ ${reports}
</body>