Author: mstruk
Date: 2011-03-03 09:30:56 -0500 (Thu, 03 Mar 2011)
New Revision: 5958
Modified:
portal/trunk/testsuite/htmlunit-tests/pom.xml
portal/trunk/testsuite/htmlunit-tests/src/test/java/org/jboss/gatein/htmlunit/common/WebHelper.java
Log:
htmlunit-tests: added system properties to be able to override at mvn execution time +
sensible defaults
Modified: portal/trunk/testsuite/htmlunit-tests/pom.xml
===================================================================
--- portal/trunk/testsuite/htmlunit-tests/pom.xml 2011-03-03 12:37:38 UTC (rev 5957)
+++ portal/trunk/testsuite/htmlunit-tests/pom.xml 2011-03-03 14:30:56 UTC (rev 5958)
@@ -33,6 +33,11 @@
<properties>
<testng.suite.file>testng.xml</testng.suite.file>
+ <test.host>localhost</test.host>
+ <test.port>8080</test.port>
+ <test.portalContainer>portal</test.portalContainer>
+ <test.waitTimeout>20</test.waitTimeout>
+ <test.shortPause>3</test.shortPause>
</properties>
<!-- no tests by default -->
@@ -78,6 +83,28 @@
<!--suiteXmlFiles>
<suiteXmlFile>src/test/resources/${testng.suite.file}</suiteXmlFile>
</suiteXmlFiles-->
+ <systemProperties>
+ <property>
+ <name>test.host</name>
+ <value>${test.host}</value>
+ </property>
+ <property>
+ <name>test.port</name>
+ <value>${test.port}</value>
+ </property>
+ <property>
+ <name>test.portalContainer</name>
+ <value>${test.portalContainer}</value>
+ </property>
+ <property>
+ <name>test.waitTimeout</name>
+ <value>${test.waitTimeout}</value>
+ </property>
+ <property>
+ <name>test.shortPause</name>
+ <value>${test.shortPause}</value>
+ </property>
+ </systemProperties>
</configuration>
</execution>
</executions>
Modified:
portal/trunk/testsuite/htmlunit-tests/src/test/java/org/jboss/gatein/htmlunit/common/WebHelper.java
===================================================================
---
portal/trunk/testsuite/htmlunit-tests/src/test/java/org/jboss/gatein/htmlunit/common/WebHelper.java 2011-03-03
12:37:38 UTC (rev 5957)
+++
portal/trunk/testsuite/htmlunit-tests/src/test/java/org/jboss/gatein/htmlunit/common/WebHelper.java 2011-03-03
14:30:56 UTC (rev 5958)
@@ -44,20 +44,21 @@
private String host = "localhost";
/** Port to use for web session */
- private int port = 8888;
+ private int port = 8080;
/** Portal container to use for web session */
private String portalContainer = "portal";
- /** Current page */
- private HtmlPage page;
-
/** Time to wait (in seconds) for element or text to appear in the page */
- private int timeout = 20;
+ private int waitTimeout = 20;
/** Short pause period (in seconds)*/
private int shortPause = 3;
+ /** Current page */
+ private HtmlPage page;
+
+
/** Get HTMLUnit WebClient instance representing the current session */
public WebClient getWebClient()
{
@@ -66,10 +67,35 @@
webClient = new WebClient();
webClient.setThrowExceptionOnFailingStatusCode(false);
webClient.setThrowExceptionOnScriptError(false);
+
+ initFromSystemProps();
}
return webClient;
}
+ private void initFromSystemProps()
+ {
+ String val = System.getProperty("test.host");
+ if (val != null)
+ host = val;
+
+ val = System.getProperty("test.port");
+ if (val != null)
+ port = Integer.parseInt(val);
+
+ val = System.getProperty("test.portalContainer");
+ if (val != null)
+ portalContainer = val;
+
+ val = System.getProperty("test.waitTimeout");
+ if (val != null)
+ waitTimeout = Integer.parseInt(val);
+
+ val = System.getProperty("test.shortPause");
+ if (val != null)
+ shortPause = Integer.parseInt(val);
+ }
+
/**
* Open GateIn's home page.
*
@@ -144,7 +170,7 @@
{
for (int second = 0; ; second++)
{
- if (second >= timeout)
+ if (second >= waitTimeout)
{
Assert.fail("Timeout at waitForElementPresent: " + el);
}
@@ -190,7 +216,7 @@
{
for (int second = 0; ; second++)
{
- if (second >= timeout)
+ if (second >= waitTimeout)
{
//System.out.println("[DEBUG] " + page.asXml());
Assert.fail("Timeout at waitForTextPresent: " + text);
@@ -207,7 +233,7 @@
{
for (int second = 0; ; second++)
{
- if (second >= timeout)
+ if (second >= waitTimeout)
{
Assert.fail("Timeout at waitForTextPresent: " + text);
}
Show replies by date