You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2007/03/03 19:30:14 UTC

svn commit: r514215 - in /tapestry/tapestry5/tapestry-core/trunk: ./ src/main/java/org/apache/tapestry/internal/services/ src/test/conf/ src/test/java/org/apache/tapestry/integration/ src/test/java/org/apache/tapestry/internal/services/

Author: hlship
Date: Sat Mar  3 10:30:13 2007
New Revision: 514215

URL: http://svn.apache.org/viewvc?view=rev&rev=514215
Log:
Split test base classes and utilities out into new module tapestry-test.

Added:
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/FieldValidatorDefaultSourceImplTest.java
      - copied unchanged from r510990, tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/FieldValidatorDefaultSourceImplTest.java
Removed:
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/FieldValidatorDefaultSourceImplTest.java
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/JettyRunner.java
Modified:
    tapestry/tapestry5/tapestry-core/trunk/pom.xml
    tapestry/tapestry5/tapestry-core/trunk/src/test/conf/testng.xml
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/IntegrationTests.java

Modified: tapestry/tapestry5/tapestry-core/trunk/pom.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/pom.xml?view=diff&rev=514215&r1=514214&r2=514215
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/pom.xml (original)
+++ tapestry/tapestry5/tapestry-core/trunk/pom.xml Sat Mar  3 10:30:13 2007
@@ -1,108 +1,99 @@
 <project 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/maven-v4_0_0.xsd">
-    <modelVersion>4.0.0</modelVersion>
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.tapestry</groupId>
+  <artifactId>tapestry-core</artifactId>
+  <packaging>jar</packaging>
+  <version>5.0.3-SNAPSHOT</version>
+  <parent>
     <groupId>org.apache.tapestry</groupId>
-    <artifactId>tapestry-core</artifactId>
-    <packaging>jar</packaging>
+    <artifactId>tapestry-project</artifactId>
     <version>5.0.3-SNAPSHOT</version>
-    <parent>
-        <groupId>org.apache.tapestry</groupId>
-        <artifactId>tapestry-project</artifactId>
-        <version>5.0.3-SNAPSHOT</version>
-        <relativePath>../tapestry-project/pom.xml</relativePath>
-    </parent>
-    <name>Tapestry Core Library</name>
-    <inceptionYear>2006</inceptionYear>
-    <!-- Due to Maven 2 bugs, this has to be copied into each module POM. -->
-    <url>http://tapestry.apache.org/tapestry5/${pom.artifactId}/</url>
-    <scm>
-        <connection>scm:svn:https://svn.apache.org/repos/asf/tapestry/tapestry5/${pom.artifactId}/trunk/</connection>
-        <url>http://svn.apache.org/viewvc/tapestry/tapestry5/${pom.artifactId}/trunk/</url>
-    </scm>
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.tapestry</groupId>
-            <artifactId>tapestry-ioc</artifactId>
-        </dependency>
-        <!-- This should be a transitive dependency from tapestry-ioc, but for some reason,
+    <relativePath>../tapestry-project/pom.xml</relativePath>
+  </parent>
+  <name>Tapestry Core Library</name>
+  <inceptionYear>2006</inceptionYear>
+  <!-- Due to Maven 2 bugs, this has to be copied into each module POM. -->
+  <url>http://tapestry.apache.org/tapestry5/${pom.artifactId}/</url>
+  <scm>
+    <connection>scm:svn:https://svn.apache.org/repos/asf/tapestry/tapestry5/${pom.artifactId}/trunk/</connection>
+    <url>http://svn.apache.org/viewvc/tapestry/tapestry5/${pom.artifactId}/trunk/</url>
+  </scm>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.tapestry</groupId>
+      <artifactId>tapestry-ioc</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.tapestry</groupId>
+      <artifactId>tapestry-test</artifactId>
+      <!-- This would be test, but we provide a few base classes that depend on TestNG, which is provided by tapestry-test. -->
+      <scope>provided</scope>
+    </dependency>
+    <!-- This should be a transitive dependency from tapestry-ioc, but for some reason,
              it needs to be explicitly listed. -->
-        <dependency>
-            <groupId>commons-logging</groupId>
-            <artifactId>commons-logging</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>commons-codec</groupId>
-            <artifactId>commons-codec</artifactId>
-            <version>1.3</version>
-        </dependency>
-        <dependency>
-            <groupId>org.easymock</groupId>
-            <artifactId>easymock</artifactId>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.testng</groupId>
-            <artifactId>testng</artifactId>
-            <version>5.1</version>
-            <classifier>jdk15</classifier>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>javax.servlet</groupId>
-            <artifactId>servlet-api</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>log4j</groupId>
-            <artifactId>log4j</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.openqa.selenium.client-drivers</groupId>
-            <artifactId>selenium-java-client-driver</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.openqa.selenium.server</groupId>
-            <artifactId>selenium-server</artifactId>
-        </dependency>
-    </dependencies>
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-surefire-plugin</artifactId>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-source-plugin</artifactId>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-assembly-plugin</artifactId>
-            </plugin>
-            <!-- This gets the plugin to clean up the cobertura.ser file left
+    <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>commons-codec</groupId>
+      <artifactId>commons-codec</artifactId>
+      <version>1.3</version>
+    </dependency>
+    <dependency>
+      <groupId>org.easymock</groupId>
+      <artifactId>easymock</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>servlet-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+    </dependency>
+  </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-source-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-assembly-plugin</artifactId>
+      </plugin>
+      <!-- This gets the plugin to clean up the cobertura.ser file left
                 in the root directory. -->
-            <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>cobertura-maven-plugin</artifactId>
-                <version>${cobertura-plugin-version}</version>
-                <executions>
-                    <execution>
-                        <id>clean</id>
-                        <goals>
-                            <goal>clean</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
-    <reporting>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-javadoc-plugin</artifactId>
-                <configuration>
-                    <!--
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>cobertura-maven-plugin</artifactId>
+        <version>${cobertura-plugin-version}</version>
+        <executions>
+          <execution>
+            <id>clean</id>
+            <goals>
+              <goal>clean</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  <reporting>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-javadoc-plugin</artifactId>
+        <configuration>
+          <!--
                     <tags>
                         <tag>
                             <name>todo</name>
@@ -111,33 +102,33 @@
                             <head>To do something:</head>
                         </tag>
                     </tags> -->
-                    <linksource>true</linksource>
-                    <links>
-                        <link>http://java.sun.com/j2se/1.5.0/docs/api/</link>
-                        <link>http://jakarta.apache.org/commons/logging/apidocs/</link>
-                        <link>http://tapestry.apache.org/tapestry5/tapestry-ioc/apidocs/</link>
-                    </links>
-                    <stylesheetfile>${basedir}/src/site/resources/css/jdstyle.css</stylesheetfile>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>cobertura-maven-plugin</artifactId>
-                <version>${cobertura-plugin-version}</version>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-surefire-report-plugin</artifactId>
-            </plugin>
-            
-            <plugin>
-                <groupId>org.apache.tapestry</groupId>
-                <artifactId>tapestry-component-report</artifactId>
-                <version>5.0.2</version>
-                <configuration>
-                    <rootPackage>org.apache.tapestry.corelib</rootPackage>
-                </configuration>                
-            </plugin>
-        </plugins>
-    </reporting>
+          <linksource>true</linksource>
+          <links>
+            <link>http://java.sun.com/j2se/1.5.0/docs/api/</link>
+            <link>http://jakarta.apache.org/commons/logging/apidocs/</link>
+            <link>http://tapestry.apache.org/tapestry5/tapestry-ioc/apidocs/</link>
+          </links>
+          <stylesheetfile>${basedir}/src/site/resources/css/jdstyle.css</stylesheetfile>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>cobertura-maven-plugin</artifactId>
+        <version>${cobertura-plugin-version}</version>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-report-plugin</artifactId>
+      </plugin>
+
+      <plugin>
+        <groupId>org.apache.tapestry</groupId>
+        <artifactId>tapestry-component-report</artifactId>
+        <version>5.0.2</version>
+        <configuration>
+          <rootPackage>org.apache.tapestry.corelib</rootPackage>
+        </configuration>
+      </plugin>
+    </plugins>
+  </reporting>
 </project>

Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/conf/testng.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/conf/testng.xml?view=diff&rev=514215&r1=514214&r2=514215
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/conf/testng.xml (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/conf/testng.xml Sat Mar  3 10:30:13 2007
@@ -16,6 +16,7 @@
 -->
 
 <suite name="Tapestry Core" parallel="false" thread-count="10" annotations="1.5" verbose="2">
+  <parameter name="tapestry.integration-webapp" value="src/test/app1"/>
   <test name="Tapestry Core">
     <packages>
       <package name="org.apache.tapestry.test.pagelevel"/>

Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/IntegrationTests.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/IntegrationTests.java?view=diff&rev=514215&r1=514214&r2=514215
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/IntegrationTests.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/IntegrationTests.java Sat Mar  3 10:30:13 2007
@@ -14,8 +14,6 @@
 
 package org.apache.tapestry.integration;
 
-import static java.lang.String.format;
-
 import java.io.BufferedInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
@@ -25,41 +23,21 @@
 import org.apache.tapestry.internal.services.InjectComponentWorker;
 import org.apache.tapestry.ioc.Resource;
 import org.apache.tapestry.ioc.internal.util.ClasspathResource;
-import org.openqa.selenium.server.SeleniumServer;
-import org.testng.Assert;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
+import org.apache.tapestry.test.AbstractIntegrationTestSuite;
 import org.testng.annotations.Test;
 
-import com.thoughtworks.selenium.DefaultSelenium;
-import com.thoughtworks.selenium.Selenium;
-
 /**
  * Note: If these tests fail with BindException when starting Jetty, it could be Skype. At least on
  * my system, Skype is listening on localhost:80.
  */
 @Test(timeOut = 50000, sequential = true, groups =
 { "integration" })
-public class IntegrationTests extends Assert
+public class IntegrationTests extends AbstractIntegrationTestSuite
 {
-    /** 60 seconds */
-    public static final String PAGE_LOAD_TIMEOUT = "600000";
-
-    private static final int JETTY_PORT = 9999;
-
-    private static final String BASE_URL = format("http://localhost:%d/", JETTY_PORT);
-
-    private JettyRunner _jettyRunner;
-
-    private Selenium _selenium;
-
-    private SeleniumServer _server;
-
     @Test
     public void any_component()
     {
-
-        _selenium.open(BASE_URL);
+        open(BASE_URL);
 
         clickAndWait("link=AnyDemo");
 
@@ -75,7 +53,7 @@
     @Test
     public void assets() throws Exception
     {
-        _selenium.open(BASE_URL);
+        open(BASE_URL);
         clickAndWait("link=AssetDemo");
 
         assertText("//img[@id='img']/@src", "/images/tapestry_banner.gif");
@@ -108,7 +86,7 @@
         // OK ... this could be a separate test, but for efficiency, we'll mix it in here.
         // It takes a while to start up Selenium RC (and a Firefox browser).
 
-        _selenium.open(BASE_URL);
+        open(BASE_URL);
 
         clickAndWait("link=Count Page");
 
@@ -121,18 +99,18 @@
     @Test
     public void block_rendering() throws Exception
     {
-        _selenium.open(BASE_URL);
+        open(BASE_URL);
         clickAndWait("link=BlockDemo");
 
         assertTextPresent("[]");
 
-        _selenium.select("//select[@id='blockName']", "fred");
-        _selenium.waitForPageToLoad(PAGE_LOAD_TIMEOUT);
+        select("//select[@id='blockName']", "fred");
+        waitForPageToLoad(PAGE_LOAD_TIMEOUT);
 
         assertTextPresent("[Block fred.]");
 
-        _selenium.select("//select[@id='blockName']", "barney");
-        _selenium.waitForPageToLoad(PAGE_LOAD_TIMEOUT);
+        select("//select[@id='blockName']", "barney");
+        waitForPageToLoad(PAGE_LOAD_TIMEOUT);
 
         assertTextPresent("[Block barney.]");
 
@@ -141,7 +119,7 @@
     @Test
     public void component_parameter_default_from_method() throws Exception
     {
-        _selenium.open(BASE_URL);
+        open(BASE_URL);
         clickAndWait("link=ParameterDefault");
 
         assertTextPresent("Echo component default: [org.apache.tapestry.integration.app1.pages.ParameterDefault:echo]");
@@ -150,7 +128,7 @@
     @Test
     public void embedded_components()
     {
-        _selenium.open(BASE_URL);
+        open(BASE_URL);
 
         clickAndWait("link=Countdown Page");
 
@@ -168,7 +146,7 @@
     @Test
     public void environmental()
     {
-        _selenium.open(BASE_URL);
+        open(BASE_URL);
 
         clickAndWait("link=Environmental Annotation Useage");
 
@@ -178,7 +156,7 @@
     @Test
     public void exception_report()
     {
-        _selenium.open(BASE_URL);
+        open(BASE_URL);
 
         clickAndWait("link=BadTemplate Page");
 
@@ -192,7 +170,7 @@
     @Test
     public void expansion()
     {
-        _selenium.open(BASE_URL);
+        open(BASE_URL);
 
         clickAndWait("link=Expansion Page");
 
@@ -207,7 +185,7 @@
     @Test
     public void inject_component_failure() throws Exception
     {
-        _selenium.open(BASE_URL);
+        open(BASE_URL);
         clickAndWait("link=InjectComponentMismatch");
 
         // And exception message:
@@ -218,7 +196,7 @@
     @Test
     public void injection() throws Exception
     {
-        _selenium.open(BASE_URL);
+        open(BASE_URL);
 
         clickAndWait("link=Inject Demo");
 
@@ -235,7 +213,7 @@
     @Test
     public void instance_mixin()
     {
-        _selenium.open(BASE_URL);
+        open(BASE_URL);
 
         final String[] dates =
         { "Jun 13, 1999", "Jul 15, 2001", "Dec 4, 2005" };
@@ -261,7 +239,7 @@
     @Test
     public void localization()
     {
-        _selenium.open(BASE_URL);
+        open(BASE_URL);
         clickAndWait("link=Localization");
 
         assertTextPresent("Via injected Messages property: [Accessed via injected Messages]");
@@ -276,7 +254,7 @@
     @Test
     public void page_injection() throws Exception
     {
-        _selenium.open(BASE_URL);
+        open(BASE_URL);
 
         clickAndWait("link=Inject Demo");
 
@@ -297,7 +275,7 @@
     @Test
     public void passivate_activate() throws Exception
     {
-        _selenium.open(BASE_URL);
+        open(BASE_URL);
         clickAndWait("link=NumberSelect");
         clickAndWait("link=5");
         assertTextPresent("You chose 5.");
@@ -306,12 +284,12 @@
     @Test
     public void password_field()
     {
-        _selenium.open(BASE_URL);
+        open(BASE_URL);
 
         clickAndWait("link=PasswordFieldDemo");
 
-        _selenium.type("userName", "howard");
-        _selenium.type("password", "wrong-password");
+        type("userName", "howard");
+        type("password", "wrong-password");
 
         clickAndWait("//input[@type='submit']");
 
@@ -322,7 +300,7 @@
         assertTextPresent("[howard]");
         assertTextPresent("[wrong-password]");
 
-        _selenium.type("password", "tapestry");
+        type("password", "tapestry");
 
         clickAndWait("//input[@type='submit']");
 
@@ -332,7 +310,7 @@
     @Test
     public void render_phase_method_returns_a_component() throws Exception
     {
-        _selenium.open(BASE_URL);
+        open(BASE_URL);
         clickAndWait("link=RenderComponentDemo");
 
         assertText("//span[@id='container']", "[]");
@@ -355,7 +333,7 @@
     @Test
     public void render_phase_order()
     {
-        _selenium.open(BASE_URL);
+        open(BASE_URL);
 
         clickAndWait("link=RenderPhaseOrder");
 
@@ -365,7 +343,7 @@
     @Test
     public void server_side_validation_for_textfield_and_textarea() throws Exception
     {
-        _selenium.open(BASE_URL);
+        open(BASE_URL);
         clickAndWait("link=ValidForm");
         clickAndWait("//input[@type='submit']");
         assertTextPresent("You must provide a value for Email.");
@@ -379,9 +357,9 @@
         assertText("//input[@id='email']/@class", "t-error");
         assertText("//textarea[@id='message']/@class", "t-error");
 
-        _selenium.type("email", "foo@bar.baz");
-        _selenium.type("message", "Show me the money!");
-        _selenium.type("hours", "foo");
+        type("email", "foo@bar.baz");
+        type("message", "Show me the money!");
+        type("hours", "foo");
 
         clickAndWait("//input[@type='submit']");
 
@@ -390,8 +368,8 @@
 
         assertText("//input[@id='hours']/@value", "foo");
 
-        _selenium.type("hours", " 19 ");
-        _selenium.click("//input[@id='urgent']");
+        type("hours", " 19 ");
+        click("//input[@id='urgent']");
         clickAndWait("//input[@type='submit']");
 
         // Make sure the decoration went away.
@@ -409,31 +387,16 @@
         assertTextPresent("[19]");
     }
 
-    @AfterClass
-    public void cleanup() throws Exception
-    {
-        // Thread.sleep(10000);
-        _selenium.stop();
-
-        _selenium = null;
-
-        _server.stop();
-        _server = null;
-
-        _jettyRunner.stop();
-        _jettyRunner = null;
-    }
-
     @Test
     public void simple_component_event()
     {
         final String YOU_CHOSE = "You chose: ";
 
-        _selenium.open(BASE_URL);
+        open(BASE_URL);
 
         clickAndWait("link=Action Page");
 
-        assertFalse(_selenium.isTextPresent(YOU_CHOSE));
+        assertFalse(isTextPresent(YOU_CHOSE));
 
         for (int i = 2; i < 5; i++)
         {
@@ -450,7 +413,7 @@
     @Test
     public void simple_form()
     {
-        _selenium.open(BASE_URL);
+        open(BASE_URL);
 
         clickAndWait("link=SimpleForm");
 
@@ -467,11 +430,11 @@
         assertFieldValue("department", "ACCOUNTING");
         assertFieldValue("urgent", "on");
 
-        _selenium.type("email", "foo@bar.baz");
-        _selenium.type("message", "Message for you, sir!");
-        _selenium.select("operatingSystem", "Windows NT");
-        _selenium.select("department", "R&D");
-        _selenium.click("urgent");
+        type("email", "foo@bar.baz");
+        type("message", "Message for you, sir!");
+        select("operatingSystem", "Windows NT");
+        select("department", "R&D");
+        click("urgent");
 
         clickAndWait("//input[@type='submit']");
 
@@ -491,30 +454,10 @@
         // Haven't figured out how to get selenium to check that fields are disabled.
     }
 
-    @BeforeClass
-    public void setup() throws Exception
-    {
-        _jettyRunner = new JettyRunner("/", JETTY_PORT, "src/test/app1");
-
-        _server = new SeleniumServer();
-
-        _server.start();
-
-        _selenium = new DefaultSelenium("localhost", SeleniumServer.DEFAULT_PORT, "*firefox",
-                BASE_URL);
-
-        _selenium.start();
-
-        // Warm things up; this prevents errors when the first test runs. Seems to be a problem
-        // with Selenium: inside the JavaScript or the server code.
-
-        _selenium.open(BASE_URL);
-    }
-
     @Test
     public void subclass_inherits_parent_template()
     {
-        _selenium.open(BASE_URL);
+        open(BASE_URL);
 
         clickAndWait("link=ExpansionSubclass");
 
@@ -524,7 +467,7 @@
     @Test
     public void template_overridden()
     {
-        _selenium.open(BASE_URL);
+        open(BASE_URL);
 
         clickAndWait("link=Template Overriden by Class Page");
 
@@ -541,7 +484,7 @@
     @Test
     public void flash_persistence()
     {
-        _selenium.open(BASE_URL);
+        open(BASE_URL);
 
         clickAndWait("link=FlashDemo");
 
@@ -556,78 +499,6 @@
         assertTextPresent("[]");
     }
 
-    private void assertSourcePresent(String... expected)
-    {
-        String source = _selenium.getHtmlSource();
-
-        for (String snippet : expected)
-        {
-            if (source.contains(snippet))
-                continue;
-
-            System.err.printf("Source content '%s' not found in:\n%s\n\n", snippet, source);
-
-            throw new AssertionError("Page did not contain source '" + snippet + "'.");
-        }
-    }
-
-    private void assertText(String locator, String expected)
-    {
-        String actual = null;
-
-        try
-        {
-            actual = _selenium.getText(locator);
-        }
-        catch (RuntimeException ex)
-        {
-            System.err.printf(
-                    "Error accessing %s: %s, in:\n\n%s\n\n",
-                    locator,
-                    ex.getMessage(),
-                    _selenium.getHtmlSource());
-
-            throw ex;
-        }
-
-        if (actual.equals(expected))
-            return;
-
-        System.err.printf(
-                "Text for %s should be '%s' but is '%s', in:\n\n%s\n\n",
-                locator,
-                expected,
-                actual,
-                _selenium.getHtmlSource());
-
-        throw new AssertionError(String.format("%s was '%s' not '%s'", locator, actual, expected));
-    }
-
-    private void assertTextPresent(String... text)
-    {
-        for (String item : text)
-        {
-            if (_selenium.isTextPresent(item))
-                return;
-
-            System.err.printf("Text pattern '%s' not found in:\n%s\n\n", item, _selenium
-                    .getHtmlSource());
-
-            throw new AssertionError("Page did not contain '" + item + "'.");
-        }
-    }
-
-    private void assertFieldValue(String locator, String expected)
-    {
-        assertEquals(_selenium.getValue(locator), expected);
-    }
-
-    private void clickAndWait(String link)
-    {
-        _selenium.click(link);
-        _selenium.waitForPageToLoad(PAGE_LOAD_TIMEOUT);
-    }
-
     private byte[] readContent(URL url) throws Exception
     {
         InputStream is = new BufferedInputStream(url.openStream());
@@ -654,7 +525,7 @@
 
     private void test_loop_inside_form(String linkLabel)
     {
-        _selenium.open(BASE_URL);
+        open(BASE_URL);
 
         clickAndWait("link=" + linkLabel);
         clickAndWait("reset");
@@ -663,9 +534,9 @@
         assertFieldValue("title_0", "Develop Faster-Than-Light Travel");
         assertFieldValue("title_1", "Cure Common Cold");
 
-        _selenium.type("title", "End World Hunger - today");
-        _selenium.type("title_0", "Develop Faster-Than-Light Travel - immediately");
-        _selenium.type("title_1", "Cure Common Cold - post haste");
+        type("title", "End World Hunger - today");
+        type("title_0", "Develop Faster-Than-Light Travel - immediately");
+        type("title_1", "Cure Common Cold - post haste");
 
         clickAndWait("//input[@value='Update ToDos']");
 
@@ -675,7 +546,7 @@
 
         clickAndWait("addNew");
 
-        _selenium.type("title_2", "Conquer World");
+        type("title_2", "Conquer World");
 
         clickAndWait("//input[@value='Update ToDos']");
 
@@ -694,7 +565,7 @@
     {
         String submitButton = "//input[@id='submit']";
 
-        _selenium.open(BASE_URL);
+        open(BASE_URL);
         clickAndWait("link=BeanEditor Demo");
         clickAndWait("link=Clear Data");
         clickAndWait(submitButton);
@@ -713,11 +584,11 @@
 
         assertText("//input[@id='submit']/@value", "Register");
 
-        _selenium.type("firstName", "a");
-        _selenium.type("lastName", "b");
-        _selenium.type("birthYear", "");
-        _selenium.select("sex", "label=Martian");
-        _selenium.click("citizen");
+        type("firstName", "a");
+        type("lastName", "b");
+        type("birthYear", "");
+        select("sex", "label=Martian");
+        click("citizen");
 
         clickAndWait(submitButton);
 
@@ -726,9 +597,9 @@
                 "You must provide at least 5 characters for Last Name.",
                 "You must provide a value for Year of Birth.");
 
-        _selenium.type("firstName", "Howard");
-        _selenium.type("lastName", "Lewis Ship");
-        _selenium.type("birthYear", "1966");
+        type("firstName", "Howard");
+        type("lastName", "Lewis Ship");
+        type("birthYear", "1966");
 
         clickAndWait(submitButton);
 
@@ -738,29 +609,19 @@
     @Test
     public void pageloaded_lifecycle_method_invoked()
     {
-        _selenium.open(BASE_URL);
+        open(BASE_URL);
         clickAndWait("link=PageLoaded Demo");
 
         assertTextPresent("[pageLoaded() was invoked.]");
     }
 
-    private void assertTextSeries(String idFormat, int startIndex, String... values)
-    {
-        for (int i = 0; i < values.length; i++)
-        {
-            String id = String.format(idFormat, startIndex + i);
-
-            assertText(id, values[i]);
-        }
-    }
-
     /**
      * Basic Grid rendering, with a column render override. Also tests sorting.
      */
     @Test
     public void basic_grid()
     {
-        _selenium.open(BASE_URL);
+        open(BASE_URL);
         clickAndWait("link=Grid Demo");
 
         assertTextSeries("//th[%d]", 1, "Title", "Album", "Artist", "Genre", "Play Count", "Rating");
@@ -845,7 +706,7 @@
     @Test
     public void grid_from_explicit_interface_model()
     {
-        _selenium.open(BASE_URL);
+        open(BASE_URL);
         clickAndWait("link=SimpleTrack Grid Demo");
 
         assertTextSeries("//th[%d]", 1, "Title", "Album", "Rating");
@@ -856,7 +717,7 @@
     @Test
     public void grid_enum_display()
     {
-        _selenium.open(BASE_URL);
+        open(BASE_URL);
         clickAndWait("link=Grid Enum Demo");
         clickAndWait("link=reset");
 
@@ -868,7 +729,7 @@
     @Test
     public void stream_response() throws Exception
     {
-        _selenium.open(BASE_URL);
+        open(BASE_URL);
 
         clickAndWait("link=Text Stream Response");
 
@@ -878,7 +739,7 @@
     @Test
     public void null_grid() throws Exception
     {
-        _selenium.open(BASE_URL);
+        open(BASE_URL);
 
         clickAndWait("link=Null Grid");
 
@@ -888,7 +749,7 @@
     @Test
     public void navigation_response_from_page_activate() throws Exception
     {
-        _selenium.open(BASE_URL);
+        open(BASE_URL);
 
         clickAndWait("link=Protected Page");
 
@@ -902,7 +763,7 @@
     @Test
     public void mixed_page_activation_context_and_component_context()
     {
-        _selenium.open(BASE_URL);
+        open(BASE_URL);
 
         clickAndWait("link=Kicker");
 
@@ -920,7 +781,7 @@
     @Test
     public void page_link_with_explicit_activation_context()
     {
-        _selenium.open(BASE_URL);
+        open(BASE_URL);
 
         clickAndWait("link=PageLink Context Demo");
 
@@ -944,7 +805,7 @@
     @Test
     public void client_side_validation()
     {
-        _selenium.open(BASE_URL);
+        open(BASE_URL);
 
         clickAndWait("link=Client Validation Demo");
 
@@ -957,8 +818,8 @@
         clickAndWait("link=Clear Data");
 
         // Notice: click, not click and wait.
-        
-        _selenium.click("submit");
+
+        click("submit");
 
         assertTextSeries(
                 "//li[%d]",
@@ -967,15 +828,15 @@
                 "Everyone has to have a last name!",
                 "Year of Birth requires a value of at least 1900.");
 
-        _selenium.type("firstName", "Howard");
-        _selenium.type("lastName", "Lewis Ship");
-        _selenium.type("birthYear", "1000");
-        _selenium.click("submit");
+        type("firstName", "Howard");
+        type("lastName", "Lewis Ship");
+        type("birthYear", "1000");
+        click("submit");
 
         assertText("//li", "Year of Birth requires a value of at least 1900.");
 
-        _selenium.type("birthYear", "1966");
-        _selenium.click("citizen");
+        type("birthYear", "1966");
+        click("citizen");
 
         clickAndWait("submit");