Author: ppitonak(a)redhat.com
Date: 2009-12-22 09:09:09 -0500 (Tue, 22 Dec 2009)
New Revision: 16189
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/pom.xml
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/stateManager/StateManagerTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/testng.xml
Log:
https://jira.jboss.org/jira/browse/RFPL-300
* test refactored -- added skipping tests if running with JSF 1.2
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/pom.xml
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/pom.xml 2009-12-22
12:20:55 UTC (rev 16188)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/pom.xml 2009-12-22
14:09:09 UTC (rev 16189)
@@ -73,6 +73,7 @@
<demo.deployable>${demo.deployable.directory}/${demo.deployable.file}</demo.deployable>
<demo.deployable.directory>${project.build.directory}</demo.deployable.directory>
<demo.deployable.file>richfaces-demo.war</demo.deployable.file>
+ <jsf.majorVersion>1</jsf.majorVersion>
</properties>
<build>
<finalName>${project.artifactId}</finalName>
@@ -225,7 +226,7 @@
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles>
- <argLine>-Dbrowser='${browser}'
-Dcontext.root='${context.root}' -Dcontext.path='${context.path}'
-Dselenium.host='${selenium.host}' -Dselenium.port='${selenium.port}'
-Dselenium.debug='${selenium.debug}'
-Dselenium.maximize='${selenium.maximize}'
-Dmaven.resources.dir='${resources.dir}'
-Dmaven.project.build.directory='${project.build.directory}'</argLine>
+ <argLine>-Dbrowser='${browser}'
-Dcontext.root='${context.root}' -Dcontext.path='${context.path}'
-Dselenium.host='${selenium.host}' -Dselenium.port='${selenium.port}'
-Dselenium.debug='${selenium.debug}'
-Dselenium.maximize='${selenium.maximize}'
-Dmaven.resources.dir='${resources.dir}'
-Dmaven.project.build.directory='${project.build.directory}'
-Djsf.majorVersion='${jsf.majorVersion}'</argLine>
<firefoxProfileTemplate>${firefoxProfileTemplate}</firefoxProfileTemplate>
<properties>
<property>
@@ -249,6 +250,7 @@
</activation>
<properties>
<demo.artifactId.suffix>-jsf2</demo.artifactId.suffix>
+ <jsf.majorVersion>2</jsf.majorVersion>
</properties>
</profile>
<!-- Container Profile -->
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/stateManager/StateManagerTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/stateManager/StateManagerTestCase.java 2009-12-22
12:20:55 UTC (rev 16188)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/stateManager/StateManagerTestCase.java 2009-12-22
14:09:09 UTC (rev 16189)
@@ -24,18 +24,19 @@
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotSame;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
import org.jboss.richfaces.integrationTest.AbstractSeleniumRichfacesTestCase;
import org.jboss.test.selenium.waiting.Condition;
import org.jboss.test.selenium.waiting.Wait;
+import org.testng.SkipException;
import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
/**
- * A test case for State Manager API. It verifies
https://jira.jboss.org/jira/browse/RF-8204. To run this
- * test, demo has to run on top of JSF 2 and server-side state serialization has to be
switched on.
+ * A test case for State Manager API. It verifies
https://jira.jboss.org/jira/browse/RF-8204. To run this test, demo has
+ * to run on top of JSF 2 and server-side state serialization has to be switched on. If
the test suite is launched with
+ * JSF 1.2, all tests in this class will be skipped.
*
* @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
* @version $Revision$
@@ -45,42 +46,42 @@
private final String LOC_HIDDEN_INPUT_PREFORMATTED =
getLoc("HIDDEN_INPUT_PREFORMATTED");
private final String LOC_LINK = getLoc("LINK");
- /**
- * Tests behavior of the application after Ajax request. It clicks on the link in
the form on the page. There
- * are three forms on the page, each of them has to contain the same value which
cannot change after Ajax request.
- */
- @Test
- public void testAjaxRequest() {
- String [] oldValues = new String[3];
- getValuesAndVerify(oldValues);
-
-
- selenium.click(LOC_LINK);
- Wait.failWith("The form did not change").until(new Condition() {
- public boolean isTrue() {
- return selenium.getText(LOC_LINK).equals("(To login)");
- }
- });
-
- String [] newValues = new String[3];
- getValuesAndVerify(newValues);
-
- assertEquals(oldValues[0], newValues[0],
- "The value attribute in all forms should not change after an Ajax
request.");
- }
+ /**
+ * Tests behavior of the application after Ajax request. It clicks on the link in the
form on the page. There are
+ * three forms on the page, each of them has to contain the same value which cannot
change after Ajax request.
+ */
+ @Test(dependsOnMethods = { "testJsfVersion" })
+ public void testAjaxRequest() {
+ String[] oldValues = new String[3];
+ getValuesAndVerify(oldValues);
+ selenium.click(LOC_LINK);
+ Wait.failWith("The form did not change").until(new Condition() {
+ public boolean isTrue() {
+ return selenium.getText(LOC_LINK).equals("(To login)");
+ }
+ });
+
+ String[] newValues = new String[3];
+ getValuesAndVerify(newValues);
+
+ assertEquals(oldValues[0], newValues[0],
+ "The value attribute in all forms should not change after an Ajax
request.");
+ }
+
/**
- * Tests behavior of the application after non-Ajax request. It reloads the page
which will cause a non-Ajax request.
- * There are three forms on the page, each of them has to contain the same value
which has to change after non-Ajax request.
+ * Tests behavior of the application after non-Ajax request. It reloads the page
which will cause a non-Ajax
+ * request. There are three forms on the page, each of them has to contain the same
value which has to change after
+ * non-Ajax request.
*/
- @Test
+ @Test(dependsOnMethods = { "testJsfVersion" })
public void testNonAjaxRequest() {
String[] oldValues = new String[3];
getValuesAndVerify(oldValues);
selenium.refresh();
waitFor(4000);
-
+
String[] newValues = new String[3];
getValuesAndVerify(newValues);
@@ -88,6 +89,11 @@
"The value attribute in all forms should change after a non-Ajax
request.");
}
+ /**
+ * Gets the "value" attribute in three form on the page and verifies that
all are the same.
+ *
+ * @param values
+ */
private void getValuesAndVerify(String[] values) {
for (int i = 0; i < 3; i++) {
values[i] = selenium.getAttribute(format(LOC_HIDDEN_INPUT_PREFORMATTED, i));
@@ -100,6 +106,21 @@
}
/**
+ * Tests that the test suite is running with JSF2. If test suite is launched with JSF
1.x, all tests in this class
+ * are skipped.
+ *
+ * @param jsfMajorVersion
+ * major version of JSF, 1 or 2
+ */
+ @Test
+ @Parameters( { "jsf.majorVersion" })
+ public void testJsfVersion(String jsfMajorVersion) {
+ if (!"2".equals(jsfMajorVersion)) {
+ throw new SkipException("Test should be launched only if running on top
of JSF 2.");
+ }
+ }
+
+ /**
* Loads the needed page.
*/
@SuppressWarnings("unused")
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/testng.xml
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/testng.xml 2009-12-22
12:20:55 UTC (rev 16188)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/testng.xml 2009-12-22
14:09:09 UTC (rev 16189)
@@ -167,22 +167,25 @@
name="org.jboss.richfaces.integrationTest.dataTable.DataTableTestCase"
/>
</classes>
</test>
-
- <test
name="org.jboss.richfaces.integrationTest.dataTable.EditTableWithModalPanelTestCase">
+
+ <test
+ name="org.jboss.richfaces.integrationTest.dataTable.EditTableWithModalPanelTestCase">
<classes>
<class
name="org.jboss.richfaces.integrationTest.dataTable.EditTableWithModalPanelTestCase"
/>
</classes>
</test>
-
- <test
name="org.jboss.richfaces.integrationTest.dataTable.ExtendedDataModelTestCase">
+
+ <test
+ name="org.jboss.richfaces.integrationTest.dataTable.ExtendedDataModelTestCase">
<classes>
<class
name="org.jboss.richfaces.integrationTest.dataTable.ExtendedDataModelTestCase"
/>
</classes>
</test>
-
- <test
name="org.jboss.richfaces.integrationTest.dataTable.ModifiableDataModelTestCase">
+
+ <test
+ name="org.jboss.richfaces.integrationTest.dataTable.ModifiableDataModelTestCase">
<classes>
<class
name="org.jboss.richfaces.integrationTest.dataTable.ModifiableDataModelTestCase"
/>
@@ -227,7 +230,7 @@
name="org.jboss.richfaces.integrationTest.extendedDataTable.DraggingTestCase"
/>
</classes>
</test>
-
+
<test
name="org.jboss.richfaces.integrationTest.extendedDataTable.FilteringTestCase">
<classes>
@@ -235,7 +238,7 @@
name="org.jboss.richfaces.integrationTest.extendedDataTable.FilteringTestCase"
/>
</classes>
</test>
-
+
<test
name="org.jboss.richfaces.integrationTest.extendedDataTable.GroupingTestCase">
<classes>
@@ -243,7 +246,7 @@
name="org.jboss.richfaces.integrationTest.extendedDataTable.GroupingTestCase"
/>
</classes>
</test>
-
+
<test
name="org.jboss.richfaces.integrationTest.extendedDataTable.SelectingTestCase">
<classes>
@@ -251,7 +254,7 @@
name="org.jboss.richfaces.integrationTest.extendedDataTable.SelectingTestCase"
/>
</classes>
</test>
-
+
<test
name="org.jboss.richfaces.integrationTest.extendedDataTable.SortingTestCase">
<classes>
@@ -343,13 +346,13 @@
</classes>
</test>
-<!-- <test-->
-<!-- name="org.jboss.richfaces.integrationTest.mediaOutput.MediaOutputTestCase">-->
-<!-- <classes>-->
-<!-- <class-->
-<!-- name="org.jboss.richfaces.integrationTest.mediaOutput.MediaOutputTestCase"
/>-->
-<!-- </classes>-->
-<!-- </test>-->
+ <!--
+ <test
+ name="org.jboss.richfaces.integrationTest.mediaOutput.MediaOutputTestCase">
+ <classes> <class
+ name="org.jboss.richfaces.integrationTest.mediaOutput.MediaOutputTestCase"
+ /> </classes> </test>
+ -->
<test
name="org.jboss.richfaces.integrationTest.modalPanel.ModalPanelTestCase">
@@ -375,11 +378,13 @@
</classes>
</test>
-<!-- <test
name="org.jboss.richfaces.integrationTest.paint2d.Paint2DTestCase">-->
-<!-- <classes>-->
-<!-- <class
name="org.jboss.richfaces.integrationTest.paint2d.Paint2DTestCase" />-->
-<!-- </classes>-->
-<!-- </test>-->
+ <!--
+ <test
+ name="org.jboss.richfaces.integrationTest.paint2d.Paint2DTestCase">
+ <classes> <class
+ name="org.jboss.richfaces.integrationTest.paint2d.Paint2DTestCase" />
+ </classes> </test>
+ -->
<test
name="org.jboss.richfaces.integrationTest.panel.PanelCustomizationTestCase">
@@ -488,12 +493,22 @@
</classes>
</test>
-<!-- <test
name="org.jboss.richfaces.integrationTest.status.StatusTestCase">-->
-<!-- <classes>-->
-<!-- <class
name="org.jboss.richfaces.integrationTest.status.StatusTestCase" />-->
-<!-- </classes>-->
-<!-- </test>-->
+ <test
+ name="org.jboss.richfaces.integrationTest.stateManager.StateManagerTestCase">
+ <classes>
+ <class
+ name="org.jboss.richfaces.integrationTest.stateManager.StateManagerTestCase"
/>
+ </classes>
+ </test>
+ <!--
+ <test
+ name="org.jboss.richfaces.integrationTest.status.StatusTestCase">
+ <classes> <class
+ name="org.jboss.richfaces.integrationTest.status.StatusTestCase" />
+ </classes> </test>
+ -->
+
<test name="org.jboss.richfaces.integrationTest.style.StyleTestCase">
<classes>
<class name="org.jboss.richfaces.integrationTest.style.StyleTestCase"
/>
@@ -507,7 +522,7 @@
name="org.jboss.richfaces.integrationTest.suggestionBox.SuggestionBoxTestCase"
/>
</classes>
</test>
-
+
<test
name="org.jboss.richfaces.integrationTest.tableFiltering.TableFilteringTestCase">
<classes>