Author: hlship
Date: Sun Mar 4 09:59:47 2007
New Revision: 514449
URL: http://svn.apache.org/viewvc?view=rev&rev=514449
Log:
Improve the documentation on how to use the library.
Modified:
tapestry/tapestry5/tapestry-test/trunk/src/site/apt/index.apt
Modified: tapestry/tapestry5/tapestry-test/trunk/src/site/apt/index.apt
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-test/trunk/src/site/apt/index.apt?view=diff&rev=514449&r1=514448&r2=514449
==============================================================================
--- tapestry/tapestry5/tapestry-test/trunk/src/site/apt/index.apt (original)
+++ tapestry/tapestry5/tapestry-test/trunk/src/site/apt/index.apt Sun Mar 4
09:59:47 2007
@@ -4,7 +4,10 @@
Tapestry Test Utilities
- This is just a couple of base classes to make it easier to build integration
test suites around Selenium.
+ This library is just a couple of base classes to make it easier to build
integration test suites around
+ {{{http://www.openqa.org/selenium/}Selenium}}.
+
+ This library is currently based on Selenium 0.8.1.
The strategy is to start, in process, a Selenimum Server (which, in turn,
starts and manages a web browser),
a Jetty instance (for the web browser to talk to), and a Selenium client
(which talks to the server).
@@ -12,4 +15,61 @@
The client is able to request URLs, fill in form data, click links, and make
assertions about output
and behavior.
- <<More details forthcoming.>>
\ No newline at end of file
+Usage and Configuration
+
+ The core part of this library is a base class for you to extend your tests
cases from:
+
{{{apidocs/org/apache/tapestry/test/AbstractIntegrationTestSuite.html}AbstractIntegrationTestSuite}}.
+
+ This class is responsible for starting an instance of Jetty to server your
web application, as well
+ as a copy of Selenium Server. It also implements the
+
{{{http://release.openqa.org/selenium-remote-control/0.9.0/doc/java/}Selenium}}
interface.
+
+ You must inform the suite about the location of your web application. This
is done inside your TestNG configuration file:
+
++---+
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
+<suite name="My Tapestry Application" parallel="false" thread-count="10"
annotations="1.5" verbose="2">
+ <test name="Integration Tests">
+ <parameter name="tapestry.integration-webapp" value="src/main/webapp"/>
+ <packages>
+ <package name="org.example.myapp"/>
+ </packages>
+ </test>
+</suite>
++---+
+
+ The \<parameter\> element is the necessary part. This will usually be
src/main/webapp.
+
+ The other part is to create a unit test suite. Here's an example from one
of the Tapestry modules:
+
+
++---+
+package org.apache.tapestry.spring;
+
+import org.apache.tapestry.test.AbstractIntegrationTestSuite;
+import org.testng.annotations.Test;
+
+public class TapestrySpringIntegrationTest extends AbstractIntegrationTestSuite
+{
+ @Test
+ public void integration_test() throws Exception
+ {
+ open(BASE_URL);
+
+ type("input", "paris in the springtime");
+ clickAndWait("//[EMAIL PROTECTED]'Convert']");
+
+ assertFieldValue("input", "PARIS IN THE SPRINGTIME");
+ }
+}
++---+
+
+ This is a very simple example, and demonstrates a mix of Selenium methods
(such as open() and type()) and
+ methods added by the AbstractIntegrationTestSuite base class (clickAndWait()
and assertFieldValue()).
+
+ Of course, a real integration test would contain many methods, and may need
to single thread their execution, or
+ even specify an execution order.
+
+ In addition, the base class extends the normal exception reporting; when a
failure occurs inside Selenium server,
+ a more detailed message, including the current page's HTML source, is
reported to System.err.
+
\ No newline at end of file