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 2009/12/15 18:47:56 UTC
svn commit: r890914 - in /tapestry/tapestry5/trunk:
tapestry-core/src/test/app1/ tapestry-core/src/test/conf/
tapestry-core/src/test/java/org/apache/tapestry5/integration/
tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/
tapestry-core...
Author: hlship
Date: Tue Dec 15 17:47:54 2009
New Revision: 890914
URL: http://svn.apache.org/viewvc?rev=890914&view=rev
Log:
Refactor out the remaining integrations tests into their own suites
Added:
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java (contents, props changed)
- copied, changed from r890913, tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/AjaxTests.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AssetTests.java (contents, props changed)
- copied, changed from r890913, tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/AssetTests.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/BeanEditorTests.java (contents, props changed)
- copied, changed from r890913, tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/BeanEditorTests.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java (contents, props changed)
- copied, changed from r890913, tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/CoreBehaviorsTests.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java (contents, props changed)
- copied, changed from r890913, tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/FormTests.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/GeneralComponentTests.java (contents, props changed)
- copied, changed from r890913, tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/GeneralComponentTests.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/GridTests.java (contents, props changed)
- copied, changed from r890913, tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/GridTests.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/LoopTests.java (contents, props changed)
- copied, changed from r890913, tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/LoopTests.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/MixinTests.java (contents, props changed)
- copied, changed from r890913, tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/MixinTests.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/PaletteTests.java (contents, props changed)
- copied, changed from r890913, tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/PaletteTests.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneTests.java (contents, props changed)
- copied, changed from r890913, tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/ZoneTests.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app3/AdditionalIntegrationTests.java (contents, props changed)
- copied, changed from r890913, tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/AdditionalIntegrationTests.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app4/ImmediateModeTests.java (contents, props changed)
- copied, changed from r890913, tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/ImmediateModeTests.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/pagetester/
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/pagetester/PageTesterTest.java (contents, props changed)
- copied, changed from r890913, tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/PageTesterTest.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/reload/ReloadTests.java (contents, props changed)
- copied, changed from r890913, tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/ReloadTests.java
tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/ErrorReporter.java (with props)
tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/ErrorReporterImpl.java (with props)
Removed:
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/AdditionalIntegrationTests.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/ImmediateModeTests.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/PageTesterTest.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/ReloadTests.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/AjaxTests.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/AssetTests.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/BeanEditorTests.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/CoreBehaviorsTests.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/FormTests.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/GeneralComponentTests.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/GridTests.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/LoopTests.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/MixinTests.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/PaletteTests.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/ZoneTests.java
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/test/app1/RadioDemo.tml
tapestry/tapestry5/trunk/tapestry-core/src/test/conf/testng.xml
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/RadioDemo.java
tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/AbstractIntegrationTestSuite.java
tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/ErrorReportingCommandProcessor.java
tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumLauncher.java
tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java
tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/TapestryTestConstants.java
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/app1/RadioDemo.tml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/app1/RadioDemo.tml?rev=890914&r1=890913&r2=890914&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/app1/RadioDemo.tml (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/app1/RadioDemo.tml Tue Dec 15 17:47:54 2009
@@ -1,5 +1,4 @@
-<html t:type="Border"
- xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
+<html t:type="Border" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<h1>Radio Demo</h1>
@@ -11,39 +10,43 @@
<t:radiogroup t:id="department" t:validate="required">
<t:loop source="departments" value="loopValue">
<p>
- <t:radio t:id="radio" value="loopValue" label="prop:label" />
- <t:label for="radio" />
+ <t:radio t:id="radio" value="loopValue" label="prop:label"/>
+ <t:label for="radio"/>
</p>
</t:loop>
</t:radiogroup>
- <br />
+ <br/>
<t:radiogroup t:id="position">
<p>
- <t:radio t:id="radio1" value="literal:TEMP" label="Temp" />
- <t:label for="radio1" />
+ <t:radio t:id="radio1" value="literal:TEMP" label="Temp"/>
+ <t:label for="radio1"/>
</p>
<p>
- <t:radio t:id="radio2" value="literal:LIFER" label="Lifer" />
- <t:label for="radio2" />
+ <t:radio t:id="radio2" value="literal:LIFER" label="Lifer"/>
+ <t:label for="radio2"/>
</p>
</t:radiogroup>
<p>
- <input type="submit" value="Update" />
+ <input type="submit" value="Update"/>
</p>
</t:form>
<t:if test="department">
- <hr />
+ <hr/>
Selected department: ${department}
</t:if>
<t:if test="position">
- <hr />
+ <hr/>
Selected position: ${position}
</t:if>
+ <p>
+ <t:actionlink t:id="reset">reset</t:actionlink>
+ </p>
+
</html>
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/conf/testng.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/conf/testng.xml?rev=890914&r1=890913&r2=890914&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/conf/testng.xml (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/conf/testng.xml Tue Dec 15 17:47:54 2009
@@ -53,11 +53,41 @@
<!-- We break these out by which of the test applications they apply to. We have a bunch. -->
<test name="Core Integration Tests" enabled="true">
<parameter name="tapestry.web-app-folder" value="src/test/app1"/>
+ <packages>
+ <package name="org.apache.tapestry5.integration.app1"/>
+ </packages>
+ <classes>
+ <class name="org.apache.tapestry5.test.SeleniumLauncher"/>
+ </classes>
+ </test>
+ <test name="Additional Integration Tests" enabled="true">
+ <parameter name="tapestry.web-app-folder" value="src/test/app3"/>
+
+ <packages>
+ <package name="org.apache.tapestry5.integration.app3"/>
+ </packages>
+ <classes>
+ <class name="org.apache.tapestry5.test.SeleniumLauncher"/>
+ </classes>
+ </test>
+ <test name="Immediate Mode Integration Tests" enabled="true">
+ <parameter name="tapestry.web-app-folder" value="src/test/app4"/>
+
+ <packages>
+ <package name="org.apache.tapestry5.integration.app4"/>
+ </packages>
<classes>
<class name="org.apache.tapestry5.test.SeleniumLauncher"/>
</classes>
+ </test>
+ <test name="Live Reload Tests" enabled="true">
+ <packages>
+ <package name="org.apache.tapestry5.integration.reload"/>
+ </packages>
+ </test>
+ <test name="PageTester Tests" enabled="true">
<packages>
- <package name="org.apache.tapestry5.integration.core"/>
+ <package name="org.apache.tapestry5.integration.pagetester"/>
</packages>
</test>
</suite>
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java?rev=890914&r1=890913&r2=890914&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java Tue Dec 15 17:47:54 2009
@@ -91,8 +91,9 @@
}
catch (RuntimeException ex)
{
- System.err.printf("Error accessing %s: %s, in:\n\n%s\n\n", locator, ex.getMessage(),
- getHtmlSource());
+ System.err.printf("Error accessing %s: %s", locator, ex.getMessage());
+
+ writeErrorReport();
throw ex;
}
@@ -100,8 +101,7 @@
if (actual.equals(expected))
return;
- System.err.printf("Text for attribute %s should be '%s' but is '%s', in:\n\n%s\n\n",
- locator, expected, actual, getHtmlSource());
+ writeErrorReport();
throw new AssertionError(String.format("%s was '%s' not '%s'", locator, actual, expected));
}
Copied: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java (from r890913, tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/AjaxTests.java)
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java?p2=tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java&p1=tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/AjaxTests.java&r1=890913&r2=890914&rev=890914&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/AjaxTests.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java Tue Dec 15 17:47:54 2009
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package org.apache.tapestry5.integration.core;
+package org.apache.tapestry5.integration.app1;
import org.apache.tapestry5.integration.TapestryCoreTestCase;
import org.testng.annotations.Test;
Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Copied: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AssetTests.java (from r890913, tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/AssetTests.java)
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AssetTests.java?p2=tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AssetTests.java&p1=tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/AssetTests.java&r1=890913&r2=890914&rev=890914&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/AssetTests.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AssetTests.java Tue Dec 15 17:47:54 2009
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package org.apache.tapestry5.integration.core;
+package org.apache.tapestry5.integration.app1;
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AssetTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Copied: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/BeanEditorTests.java (from r890913, tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/BeanEditorTests.java)
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/BeanEditorTests.java?p2=tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/BeanEditorTests.java&p1=tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/BeanEditorTests.java&r1=890913&r2=890914&rev=890914&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/BeanEditorTests.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/BeanEditorTests.java Tue Dec 15 17:47:54 2009
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package org.apache.tapestry5.integration.core;
+package org.apache.tapestry5.integration.app1;
import org.apache.tapestry5.corelib.components.BeanEditForm;
import org.apache.tapestry5.corelib.components.BeanEditor;
Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/BeanEditorTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Copied: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java (from r890913, tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/CoreBehaviorsTests.java)
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java?p2=tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java&p1=tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/CoreBehaviorsTests.java&r1=890913&r2=890914&rev=890914&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/CoreBehaviorsTests.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java Tue Dec 15 17:47:54 2009
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package org.apache.tapestry5.integration.core;
+package org.apache.tapestry5.integration.app1;
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Copied: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java (from r890913, tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/FormTests.java)
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java?p2=tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java&p1=tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/FormTests.java&r1=890913&r2=890914&rev=890914&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/FormTests.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java Tue Dec 15 17:47:54 2009
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package org.apache.tapestry5.integration.core;
+package org.apache.tapestry5.integration.app1;
import org.apache.tapestry5.corelib.components.Form;
import org.apache.tapestry5.integration.TapestryCoreTestCase;
@@ -163,10 +163,11 @@
@Test
public void radio_group_validator()
{
- clickThru("RadioDemo");
+ clickThru("RadioDemo", "reset");
// Verify that the "required" validator works.
clickAndWait(SUBMIT);
+
assertTextPresent("You must provide a value for Department.");
}
Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Copied: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/GeneralComponentTests.java (from r890913, tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/GeneralComponentTests.java)
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/GeneralComponentTests.java?p2=tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/GeneralComponentTests.java&p1=tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/GeneralComponentTests.java&r1=890913&r2=890914&rev=890914&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/GeneralComponentTests.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/GeneralComponentTests.java Tue Dec 15 17:47:54 2009
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package org.apache.tapestry5.integration.core;
+package org.apache.tapestry5.integration.app1;
import org.apache.tapestry5.integration.TapestryCoreTestCase;
import org.testng.annotations.Test;
Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/GeneralComponentTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Copied: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/GridTests.java (from r890913, tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/GridTests.java)
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/GridTests.java?p2=tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/GridTests.java&p1=tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/GridTests.java&r1=890913&r2=890914&rev=890914&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/GridTests.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/GridTests.java Tue Dec 15 17:47:54 2009
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package org.apache.tapestry5.integration.core;
+package org.apache.tapestry5.integration.app1;
import org.apache.tapestry5.corelib.components.Grid;
import org.apache.tapestry5.integration.TapestryCoreTestCase;
Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/GridTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Copied: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/LoopTests.java (from r890913, tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/LoopTests.java)
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/LoopTests.java?p2=tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/LoopTests.java&p1=tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/LoopTests.java&r1=890913&r2=890914&rev=890914&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/LoopTests.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/LoopTests.java Tue Dec 15 17:47:54 2009
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package org.apache.tapestry5.integration.core;
+package org.apache.tapestry5.integration.app1;
import org.apache.tapestry5.integration.TapestryCoreTestCase;
import org.testng.annotations.Test;
Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/LoopTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Copied: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/MixinTests.java (from r890913, tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/MixinTests.java)
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/MixinTests.java?p2=tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/MixinTests.java&p1=tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/MixinTests.java&r1=890913&r2=890914&rev=890914&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/MixinTests.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/MixinTests.java Tue Dec 15 17:47:54 2009
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package org.apache.tapestry5.integration.core;
+package org.apache.tapestry5.integration.app1;
import org.apache.tapestry5.integration.TapestryCoreTestCase;
import org.testng.annotations.Test;
Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/MixinTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Copied: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/PaletteTests.java (from r890913, tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/PaletteTests.java)
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/PaletteTests.java?p2=tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/PaletteTests.java&p1=tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/PaletteTests.java&r1=890913&r2=890914&rev=890914&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/PaletteTests.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/PaletteTests.java Tue Dec 15 17:47:54 2009
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package org.apache.tapestry5.integration.core;
+package org.apache.tapestry5.integration.app1;
import org.apache.tapestry5.corelib.components.Palette;
import org.apache.tapestry5.integration.TapestryCoreTestCase;
Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/PaletteTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Copied: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneTests.java (from r890913, tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/ZoneTests.java)
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneTests.java?p2=tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneTests.java&p1=tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/ZoneTests.java&r1=890913&r2=890914&rev=890914&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/core/ZoneTests.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneTests.java Tue Dec 15 17:47:54 2009
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package org.apache.tapestry5.integration.core;
+package org.apache.tapestry5.integration.app1;
import org.apache.tapestry5.corelib.components.Form;
import org.apache.tapestry5.corelib.components.Zone;
Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/RadioDemo.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/RadioDemo.java?rev=890914&r1=890913&r2=890914&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/RadioDemo.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/RadioDemo.java Tue Dec 15 17:47:54 2009
@@ -14,6 +14,7 @@
package org.apache.tapestry5.integration.app1.pages;
+import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.integration.app1.data.Department;
import org.apache.tapestry5.internal.TapestryInternalUtils;
@@ -33,6 +34,14 @@
@Inject
private Messages messages;
+ @Inject
+ private ComponentResources resources;
+
+ void onActionFromReset()
+ {
+ resources.discardPersistentFieldChanges();
+ }
+
public Department[] getDepartments()
{
return Department.values();
Copied: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app3/AdditionalIntegrationTests.java (from r890913, tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/AdditionalIntegrationTests.java)
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app3/AdditionalIntegrationTests.java?p2=tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app3/AdditionalIntegrationTests.java&p1=tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/AdditionalIntegrationTests.java&r1=890913&r2=890914&rev=890914&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/AdditionalIntegrationTests.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app3/AdditionalIntegrationTests.java Tue Dec 15 17:47:54 2009
@@ -12,33 +12,26 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package org.apache.tapestry5.integration;
+package org.apache.tapestry5.integration.app3;
-import org.apache.tapestry5.test.AbstractIntegrationTestSuite;
+import org.apache.tapestry5.integration.TapestryCoreTestCase;
import org.testng.annotations.Test;
/**
- * Additional integration tests that do not fit with the main group due to the need for special configuration.
+ * Additional integration tests that do not fit with the main group due to the need for special
+ * configuration.
*/
-@Test(timeOut = 50000, sequential = true, groups = {"integration"})
-public class AdditionalIntegrationTests extends AbstractIntegrationTestSuite
+public class AdditionalIntegrationTests extends TapestryCoreTestCase
{
-
- public AdditionalIntegrationTests()
- {
- super("src/test/app3");
- }
-
-
/**
* Test to prove that a redirect from the start page works correctly.
- *
+ *
* @see https://issues.apache.org/jira/browse/TAPESTRY-1627
*/
@Test
public void redirect_for_root() throws Exception
{
- open(BASE_URL);
+ openBaseURL();
assertText("//h1", "Login Page");
}
@@ -46,7 +39,7 @@
@Test
public void bean_block_overrides()
{
- start("BeanDisplay Override Demo");
+ clickThru("BeanDisplay Override Demo");
assertText("//dd[@class='no']", "Nay");
assertText("//dd[@class='yes']", "Yea");
@@ -58,7 +51,7 @@
@Test
public void activation_context_for_root_index_page()
{
- open(BASE_URL + "it$0020worked");
+ open(getBaseURL() + "it$0020worked");
assertText("//h1", "Index");
@@ -66,12 +59,12 @@
}
/**
- * TAPESTR-2217
+ * TAPESTRY-2217
*/
@Test
public void page_document_generator()
{
- start("PageDocumentGenerator demo");
+ clickThru("PageDocumentGenerator demo");
// In generated document: not optimized
assertAttribute("//a[1]/@href", "/login");
@@ -80,11 +73,11 @@
// Fuckin Selenium
// assertAttribute("//a[2]/@href", "login");
}
-
+
public void ajax_server_side_exception()
{
- start("Console demo");
-
+ clickThru("Console demo");
+
assertTextPresent("Demonstrates Tapestry console");
click("link=Failure on the server side");
Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app3/AdditionalIntegrationTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Copied: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app4/ImmediateModeTests.java (from r890913, tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/ImmediateModeTests.java)
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app4/ImmediateModeTests.java?p2=tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app4/ImmediateModeTests.java&p1=tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/ImmediateModeTests.java&r1=890913&r2=890914&rev=890914&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/ImmediateModeTests.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app4/ImmediateModeTests.java Tue Dec 15 17:47:54 2009
@@ -12,46 +12,44 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package org.apache.tapestry5.integration;
+package org.apache.tapestry5.integration.app4;
-import org.apache.tapestry5.test.AbstractIntegrationTestSuite;
+import org.apache.tapestry5.integration.TapestryCoreTestCase;
import org.testng.annotations.Test;
/**
- * Tests for immediate mode (aka T4 mode, aka {@linkplain org.apache.tapestry5.SymbolConstants#SUPPRESS_REDIRECT_FROM_ACTION_REQUESTS
+ * Tests for immediate mode (aka T4 mode, aka
+ * {@linkplain org.apache.tapestry5.SymbolConstants#SUPPRESS_REDIRECT_FROM_ACTION_REQUESTS
* redirects suppressed} mode).
*/
-@Test(timeOut = 50000, sequential = true, groups = { "integration" })
-public class ImmediateModeTests extends AbstractIntegrationTestSuite
+public class ImmediateModeTests extends TapestryCoreTestCase
{
- public ImmediateModeTests()
- {
- super("src/test/app4");
- }
-
@Test
public void action_link()
{
- start("here");
+ clickThru("here");
assertTextSeries("//dd[%d]", 1, "onActivate() invoked", "automatic value");
clickAndWait("link=refresh page");
- assertTextSeries("//dd[%d]", 1, "onActivate(String) invoked - onActivate() invoked", "automatic value");
+ assertTextSeries("//dd[%d]", 1, "onActivate(String) invoked - onActivate() invoked",
+ "automatic value");
clickAndWait("link=refresh via action");
- // The last onActivate() is due to the "default" rendering of the page for the action link (on the same page).
+ // The last onActivate() is due to the "default" rendering of the page for the action link
+ // (on the same page).
- assertTextSeries("//dd[%d]", 1, "onActivate(String) invoked - onActivate() invoked - onActivate() invoked",
- "automatic value");
+ assertTextSeries("//dd[%d]", 1,
+ "onActivate(String) invoked - onActivate() invoked - onActivate() invoked",
+ "automatic value");
}
@Test
public void form_submission()
{
- open(BASE_URL);
+ openBaseURL();
type("input", "immediate mode");
@@ -61,16 +59,18 @@
clickAndWait("link=refresh page");
- assertTextSeries("//dd[%d]", 1, "onActivate(String) invoked - onActivate() invoked", "immediate mode");
+ assertTextSeries("//dd[%d]", 1, "onActivate(String) invoked - onActivate() invoked",
+ "immediate mode");
clickAndWait("link=refresh via action");
- // The last onActivate() is due to the "default" rendering of the page for the action link (on the same page).
+ // The last onActivate() is due to the "default" rendering of the page for the action link
+ // (on the same page).
- assertTextSeries("//dd[%d]", 1, "onActivate(String) invoked - onActivate() invoked - onActivate() invoked",
- "immediate mode");
+ assertTextSeries("//dd[%d]", 1,
+ "onActivate(String) invoked - onActivate() invoked - onActivate() invoked",
+ "immediate mode");
}
-
}
Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app4/ImmediateModeTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Copied: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/pagetester/PageTesterTest.java (from r890913, tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/PageTesterTest.java)
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/pagetester/PageTesterTest.java?p2=tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/pagetester/PageTesterTest.java&p1=tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/PageTesterTest.java&r1=890913&r2=890914&rev=890914&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/PageTesterTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/pagetester/PageTesterTest.java Tue Dec 15 17:47:54 2009
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package org.apache.tapestry5.integration;
+package org.apache.tapestry5.integration.pagetester;
import org.apache.tapestry5.dom.Document;
import org.apache.tapestry5.integration.pagelevel.TestConstants;
Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/pagetester/PageTesterTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Copied: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/reload/ReloadTests.java (from r890913, tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/ReloadTests.java)
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/reload/ReloadTests.java?p2=tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/reload/ReloadTests.java&p1=tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/ReloadTests.java&r1=890913&r2=890914&rev=890914&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/ReloadTests.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/reload/ReloadTests.java Tue Dec 15 17:47:54 2009
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package org.apache.tapestry5.integration;
+package org.apache.tapestry5.integration.reload;
import javassist.*;
import org.apache.tapestry5.internal.TapestryInternalUtils;
@@ -22,7 +22,8 @@
import java.io.*;
/**
- * Integration tests designed to test Tapestry's ability to dynamically reload component classes, templates and message
+ * Integration tests designed to test Tapestry's ability to dynamically reload component classes,
+ * templates and message
* catalogs.
*/
public class ReloadTests extends AbstractIntegrationTestSuite
@@ -59,7 +60,8 @@
System.err.println("Created: " + webappDir);
}
- private void createIndexClass(int number) throws NotFoundException, CannotCompileException, IOException
+ private void createIndexClass(int number) throws NotFoundException, CannotCompileException,
+ IOException
{
ClassPool pool = new ClassPool(null);
@@ -76,13 +78,15 @@
ctClass.writeFile(classesDir.getAbsolutePath());
}
-
/**
* Copies a source file (from the classpath) to a directory as a new file name.
- *
- * @param sourceFile source file (within in the reload package)
- * @param dir directory to copy to
- * @param targetFile name of file to be created or overwritten
+ *
+ * @param sourceFile
+ * source file (within in the reload package)
+ * @param dir
+ * directory to copy to
+ * @param targetFile
+ * name of file to be created or overwritten
*/
private void copy(String sourceFile, File dir, String targetFile) throws IOException
{
@@ -90,7 +94,7 @@
FileOutputStream fos = new FileOutputStream(output);
- InputStream in = getClass().getResourceAsStream("reload/" + sourceFile);
+ InputStream in = getClass().getResourceAsStream(sourceFile);
copy(in, fos);
Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/reload/ReloadTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/AbstractIntegrationTestSuite.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/AbstractIntegrationTestSuite.java?rev=890914&r1=890913&r2=890914&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/AbstractIntegrationTestSuite.java (original)
+++ tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/AbstractIntegrationTestSuite.java Tue Dec 15 17:47:54 2009
@@ -21,6 +21,7 @@
import org.openqa.selenium.server.RemoteControlConfiguration;
import org.openqa.selenium.server.SeleniumServer;
import org.testng.Assert;
+import org.testng.ITestContext;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
@@ -294,7 +295,7 @@
}
@BeforeClass(alwaysRun = true)
- public void setup() throws Exception
+ public void setup(ITestContext testContext) throws Exception
{
jettyRunner = new JettyRunner(TapestryTestConstants.MODULE_BASE_DIR, "/", JETTY_PORT,
webappRoot, virtualHosts);
@@ -306,7 +307,9 @@
CommandProcessor cp = new HttpCommandProcessor("localhost",
RemoteControlConfiguration.DEFAULT_PORT, seleniumBrowserCommand, BASE_URL);
- selenium = new DefaultSelenium(new ErrorReportingCommandProcessor(cp));
+ ErrorReporter errorReporter = new ErrorReporterImpl(cp, testContext);
+
+ selenium = new DefaultSelenium(new ErrorReportingCommandProcessor(cp, errorReporter));
selenium.start();
}
Added: tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/ErrorReporter.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/ErrorReporter.java?rev=890914&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/ErrorReporter.java (added)
+++ tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/ErrorReporter.java Tue Dec 15 17:47:54 2009
@@ -0,0 +1,29 @@
+// Copyright 2009 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry5.test;
+
+/**
+ * Responsible for writing an error report for the current test, after an assertion fails. The HTML
+ * source for the page is downloaded and written to a
+ * file in the TestNG output directory (in a file named after the test).
+ */
+public interface ErrorReporter
+{
+ /**
+ * Writes an error report file into the TestNG output directory, based on the name of the test,
+ * containing the current page content.
+ */
+ void writeErrorReport();
+}
Propchange: tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/ErrorReporter.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/ErrorReporterImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/ErrorReporterImpl.java?rev=890914&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/ErrorReporterImpl.java (added)
+++ tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/ErrorReporterImpl.java Tue Dec 15 17:47:54 2009
@@ -0,0 +1,87 @@
+// Copyright 2009 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry5.test;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.testng.ITestContext;
+
+import com.thoughtworks.selenium.CommandProcessor;
+
+public class ErrorReporterImpl implements ErrorReporter
+{
+ private final CommandProcessor commandProcessor;
+
+ private final ITestContext testContext;
+
+ private int uid = 0;
+
+ private final Set<String> previousNames = new HashSet<String>();
+
+ public ErrorReporterImpl(CommandProcessor commandProcessor, ITestContext testContext)
+ {
+ this.commandProcessor = commandProcessor;
+ this.testContext = testContext;
+ }
+
+ public void writeErrorReport()
+ {
+ String htmlSource = commandProcessor.getString("getHtmlSource", new String[]
+ {});
+
+ File dir = new File(TapestryTestConstants.MODULE_BASE_DIR, testContext.getOutputDirectory());
+
+ dir.mkdirs();
+
+ Method testMethod = (Method) testContext
+ .getAttribute(TapestryTestConstants.CURRENT_TEST_METHOD_ATTRIBUTE);
+
+ String baseFileName = testMethod == null ? "Unknown-test" : testMethod.getDeclaringClass()
+ .getSimpleName()
+ + "." + testMethod.getName();
+
+ if (previousNames.contains(baseFileName))
+ {
+ baseFileName += "-" + uid++;
+ }
+ else
+ {
+ previousNames.add(baseFileName);
+ }
+
+ File report = new File(dir, baseFileName + "-page-content.html");
+
+ System.err.println("Writing current page's HTML source to: " + report);
+
+ try
+ {
+ FileWriter fw = new FileWriter(report);
+
+ fw.write(htmlSource);
+
+ fw.close();
+ }
+ catch (IOException ex)
+ {
+ // Ignore.
+ }
+ }
+
+}
Propchange: tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/ErrorReporterImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/ErrorReportingCommandProcessor.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/ErrorReportingCommandProcessor.java?rev=890914&r1=890913&r2=890914&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/ErrorReportingCommandProcessor.java (original)
+++ tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/ErrorReportingCommandProcessor.java Tue Dec 15 17:47:54 2009
@@ -17,15 +17,19 @@
import com.thoughtworks.selenium.CommandProcessor;
/**
- * A wrapper around a standard command processor that adds additional exception reporting when a failure occurs.
+ * A wrapper around a standard command processor that adds additional exception reporting when a
+ * failure occurs.
*/
public class ErrorReportingCommandProcessor implements CommandProcessor
{
private final CommandProcessor delegate;
- public ErrorReportingCommandProcessor(final CommandProcessor delegate)
+ private final ErrorReporter errorReporter;
+
+ public ErrorReportingCommandProcessor(CommandProcessor delegate, ErrorReporter errorReporter)
{
this.delegate = delegate;
+ this.errorReporter = errorReporter;
}
private static final String BORDER = "**********************************************************************";
@@ -41,7 +45,8 @@
for (int i = 0; i < args.length; i++)
{
- if (i > 0) builder.append(", ");
+ if (i > 0)
+ builder.append(", ");
builder.append('"');
builder.append(args[i]);
builder.append('"');
@@ -50,14 +55,11 @@
builder.append("): ");
builder.append(ex.toString());
- builder.append("\n\nPage source:\n\n");
-
- builder.append(delegate.getString("getHtmlSource", new String[] { }));
-
- builder.append("\n");
builder.append(BORDER);
System.err.println(builder.toString());
+
+ errorReporter.writeErrorReport();
}
public String doCommand(String command, String[] args)
Modified: tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumLauncher.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumLauncher.java?rev=890914&r1=890913&r2=890914&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumLauncher.java (original)
+++ tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumLauncher.java Tue Dec 15 17:47:54 2009
@@ -48,12 +48,12 @@
* <pre>
* <test name="My Integration Tests">
* <!-- parameters go here, if needed -->
- * <classes>
- * <class name="org.apache.tapestry5.test.SeleniumLauncher"/>
- * </classes>
* <packages>
* <!-- list of packages containing test suites goes here -->
* </packages>
+ * <classes>
+ * <class name="org.apache.tapestry5.test.SeleniumLauncher"/>
+ * </classes>
* </test>
* </pre>
*
@@ -91,7 +91,8 @@
* <td>contextPath</td>
* <td>tapestry.context-path</td>
* <td><em>empty string</em></td>
- * <td>Context path (defaults to root)</td>
+ * <td>Context path (defaults to root). As elsewhere, the context path should be blank, or start
+ * with a slash (but not end with one).</td>
* </tr>
* <tr>
* <td>port</td>
@@ -147,12 +148,15 @@
CommandProcessor cp = new HttpCommandProcessor("localhost",
RemoteControlConfiguration.DEFAULT_PORT, browserStartCommand, baseURL);
- selenium = new DefaultSelenium(new ErrorReportingCommandProcessor(cp));
+ ErrorReporter errorReporter = new ErrorReporterImpl(cp, testContext);
+
+ selenium = new DefaultSelenium(new ErrorReportingCommandProcessor(cp, errorReporter));
selenium.start();
testContext.setAttribute(TapestryTestConstants.BASE_URL_ATTRIBUTE, baseURL);
testContext.setAttribute(TapestryTestConstants.SELENIUM_ATTRIBUTE, selenium);
+ testContext.setAttribute(TapestryTestConstants.ERROR_REPORTER_ATTRIBUTE, errorReporter);
}
/** Shuts down the stack at the end of the test. */
Modified: tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java?rev=890914&r1=890913&r2=890914&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java (original)
+++ tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java Tue Dec 15 17:47:54 2009
@@ -19,8 +19,10 @@
import org.testng.Assert;
import org.testng.ITestContext;
import org.testng.annotations.AfterClass;
+import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Optional;
import com.thoughtworks.selenium.Selenium;
@@ -40,11 +42,19 @@
private String baseURL;
+ private ErrorReporter errorReporter;
+
+ private ITestContext testContext;
+
@BeforeClass
public void setup(ITestContext context)
{
+ this.testContext = context;
+
delegate = (Selenium) context.getAttribute(TapestryTestConstants.SELENIUM_ATTRIBUTE);
baseURL = (String) context.getAttribute(TapestryTestConstants.BASE_URL_ATTRIBUTE);
+ errorReporter = (ErrorReporter) context
+ .getAttribute(TapestryTestConstants.ERROR_REPORTER_ATTRIBUTE);
}
@AfterClass
@@ -55,6 +65,15 @@
}
/**
+ * Delegates to {@link ErrorReporter#writeErrorReport()} to capture the current page markup in a
+ * file for later analysis.
+ */
+ protected void writeErrorReport()
+ {
+ errorReporter.writeErrorReport();
+ }
+
+ /**
* Returns the base URL for the application. This is of the typically
* <code>http://localhost:9999/</code> (i.e., it includes a trailing slash).
*/
@@ -66,12 +85,20 @@
@BeforeMethod
public void indicateTestMethodName(Method testMethod)
{
+ testContext.setAttribute(TapestryTestConstants.CURRENT_TEST_METHOD_ATTRIBUTE, testMethod);
+
String className = testMethod.getDeclaringClass().getSimpleName();
String testName = testMethod.getName().replace("_", " ");
delegate.setContext(className + ": " + testName);
}
+ @AfterMethod
+ public void cleanupTestMethod()
+ {
+ testContext.setAttribute(TapestryTestConstants.CURRENT_TEST_METHOD_ATTRIBUTE, null);
+ }
+
// ---------------------------------------------------------------------
// Start of delegate methods
//
@@ -848,6 +875,8 @@
protected final void unreachable()
{
+ writeErrorReport();
+
throw new AssertionError("This statement should not be reachable.");
}
@@ -883,8 +912,7 @@
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, getHtmlSource());
+ writeErrorReport();
throw new AssertionError(String.format("%s was '%s' not '%s'", locator, actual, expected));
}
@@ -896,7 +924,7 @@
if (isTextPresent(item))
continue;
- System.err.printf("Text pattern '%s' not found in:\n%s\n\n", item, getHtmlSource());
+ writeErrorReport();
throw new AssertionError("Page did not contain '" + item + "'.");
}
@@ -917,7 +945,7 @@
if (source.contains(snippet))
continue;
- System.err.printf("Source content '%s' not found in:\n%s\n\n", snippet, source);
+ writeErrorReport();
throw new AssertionError("Page did not contain source '" + snippet + "'.");
}
Modified: tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/TapestryTestConstants.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/TapestryTestConstants.java?rev=890914&r1=890913&r2=890914&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/TapestryTestConstants.java (original)
+++ tapestry/tapestry5/trunk/tapestry-test/src/main/java/org/apache/tapestry5/test/TapestryTestConstants.java Tue Dec 15 17:47:54 2009
@@ -15,6 +15,7 @@
package org.apache.tapestry5.test;
import java.io.File;
+import java.lang.reflect.Method;
import org.testng.ITestContext;
@@ -52,10 +53,24 @@
public static final String SELENIUM_ATTRIBUTE = "tapestry.selenium";
/**
+ * {@link ITestContext} attribute holding an instance of {@link ErrorReporter}.
+ *
+ * @see SeleniumLauncher#startup(String, String, int, String, ITestContext)
+ * @since 5.2.0
+ */
+ public static final String ERROR_REPORTER_ATTRIBUTE = "tapestry.error-reporter";
+
+ /**
* {@link ITestContext} attribute holding the application's base URL.
*
* @see SeleniumLauncher#startup(String, String, int, String, ITestContext)
* @since 5.2.0
*/
public static final String BASE_URL_ATTRIBUTE = "tapestry.base-url";
+
+ /**
+ * {@link ITestContext} attribute updated to store the current test method
+ * (as a {@link Method} instance).
+ */
+ public static final String CURRENT_TEST_METHOD_ATTRIBUTE = "tapestry.current-test-method";
}