From 8c5de76d3b0866caa995637d85c04388ad445a6f Mon Sep 17 00:00:00 2001 From: Brett Porter Date: Thu, 30 Dec 2010 01:05:58 +0000 Subject: [PATCH] Customise settings so that you can debug the cargo instance, and show tests to output as they progress git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1053778 13f79535-47bb-0310-9956-ffa450edef68 --- .../archiva-web/archiva-webapp-test/pom.xml | 19 +++++++++++++++ .../src/test/resources/testng.properties | 2 -- .../archiva/web/test/ArchivaAdminTest.java | 10 ++++---- .../web/test/parent/AbstractSeleniumTest.java | 24 +++++++++---------- 4 files changed, 35 insertions(+), 20 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-webapp-test/pom.xml b/archiva-modules/archiva-web/archiva-webapp-test/pom.xml index e39f84184..8fb377461 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/pom.xml +++ b/archiva-modules/archiva-web/archiva-webapp-test/pom.xml @@ -148,6 +148,7 @@ org.apache.maven.plugins maven-surefire-plugin + false + 3600000 + + 5.5.27 false cargo-installs + 60000 diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/testng.properties b/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/testng.properties index 5ceeebe76..a25b6746f 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/testng.properties +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/testng.properties @@ -1,7 +1,5 @@ # properties for integration tests -MAX_WAIT_TIME_IN_MS=60000 - ADMIN_USERNAME=admin ADMIN_FULLNAME=Administrator ADMIN_EMAIL=admin@localhost diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArchivaAdminTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArchivaAdminTest.java index 1d876ab23..25a2d1c4d 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArchivaAdminTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArchivaAdminTest.java @@ -27,7 +27,7 @@ import org.testng.annotations.Optional; import org.testng.annotations.Parameters; import org.testng.annotations.Test; -@Test( groups = { "about" }, alwaysRun = true ) +@Test( groups = {"about"}, alwaysRun = true ) public class ArchivaAdminTest extends AbstractArchivaTest { @@ -49,12 +49,12 @@ public class ArchivaAdminTest } @BeforeTest - @Parameters( { "baseUrl", "browser", "seleniumHost", "seleniumPort" } ) - public void initializeArchiva( String baseUrl, String browser, @Optional( "localhost" ) String seleniumHost, - @Optional( "4444" ) int seleniumPort ) + @Parameters( {"baseUrl", "browser", "maxWaitTimeInMs", "seleniumHost", "seleniumPort"} ) + public void initializeArchiva( String baseUrl, String browser, int maxWaitTimeInMs, + @Optional( "localhost" ) String seleniumHost, @Optional( "4444" ) int seleniumPort ) throws Exception { - super.open( baseUrl, browser, seleniumHost, seleniumPort ); + super.open( baseUrl, browser, seleniumHost, seleniumPort, Integer.toString( maxWaitTimeInMs ) ); getSelenium().open( baseUrl ); String title = getSelenium().getTitle(); if ( title.endsWith( "Create Admin User" ) ) diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java index 61ec5e137..06cce2b22 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java @@ -19,6 +19,11 @@ package org.apache.archiva.web.test.parent; * under the License. */ +import com.thoughtworks.selenium.DefaultSelenium; +import com.thoughtworks.selenium.Selenium; +import org.apache.commons.io.IOUtils; +import org.testng.Assert; + import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; @@ -29,11 +34,6 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Properties; -import com.thoughtworks.selenium.DefaultSelenium; -import com.thoughtworks.selenium.Selenium; -import org.apache.commons.io.IOUtils; -import org.testng.Assert; - /** * @author Emmanuel Venisse * @version $Id: AbstractSeleniumTestCase.java 761154 2009-04-02 03:31:19Z wsmoak $ @@ -57,18 +57,16 @@ public abstract class AbstractSeleniumTest { p = new Properties(); p.load( this.getClass().getClassLoader().getResourceAsStream( "testng.properties" ) ); - - // baseUrl = getProperty( "BASE_URL" ); - maxWaitTimeInMs = getProperty( "MAX_WAIT_TIME_IN_MS" ); } /** * Initialize selenium */ - public void open( String baseUrl, String browser, String seleniumHost, int seleniumPort ) + public void open( String baseUrl, String browser, String seleniumHost, int seleniumPort, String maxWaitTimeInMs ) throws Exception { - this.baseUrl = baseUrl; + AbstractSeleniumTest.baseUrl = baseUrl; + AbstractSeleniumTest.maxWaitTimeInMs = maxWaitTimeInMs; if ( getSelenium() == null ) { @@ -201,7 +199,7 @@ public abstract class AbstractSeleniumTest assertElementPresent( locator ); } - + public void assertImgWithAltNotPresent( String alt ) { assertElementNotPresent( "/¯img[@alt='" + alt + "']" ); @@ -285,8 +283,8 @@ public abstract class AbstractSeleniumTest public boolean isButtonWithValuePresent( String text ) { - return isElementPresent( "//button[@value='" + text + "']" ) - || isElementPresent( "//input[@value='" + text + "']" ); + return isElementPresent( "//button[@value='" + text + "']" ) || isElementPresent( + "//input[@value='" + text + "']" ); } public boolean isButtonWithIdPresent( String text ) -- 2.39.5