You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@continuum.apache.org by ws...@apache.org on 2009/04/30 04:07:08 UTC
svn commit: r770037 - in /continuum/trunk/continuum-webapp-test: Readme.txt
pom.xml src/test/resources/testng.properties
src/test/testng/org/apache/continuum/web/test/parent/AbstractSeleniumTest.java
Author: wsmoak
Date: Thu Apr 30 02:07:07 2009
New Revision: 770037
URL: http://svn.apache.org/viewvc?rev=770037&view=rev
Log:
[CONTINUUM-2073] Merge recent changes in the JUnit pom - move Cargo plugin config to a profile to make it easier to run tests against an existing container and allow command line configuration of which browser to use.
Modified:
continuum/trunk/continuum-webapp-test/Readme.txt
continuum/trunk/continuum-webapp-test/pom.xml
continuum/trunk/continuum-webapp-test/src/test/resources/testng.properties
continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractSeleniumTest.java
Modified: continuum/trunk/continuum-webapp-test/Readme.txt
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/Readme.txt?rev=770037&r1=770036&r2=770037&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/Readme.txt (original)
+++ continuum/trunk/continuum-webapp-test/Readme.txt Thu Apr 30 02:07:07 2009
@@ -11,6 +11,16 @@
* modify src/test/resources/testng.properties as needed
* mvn clean install
+Run Selenium tests against an existing Continuum instance
+ * modify src/test/resources/testng.properties as needed
+ * mvn clean install -Dexisting-container
+
+ (This skips the Cargo plugin configuration that starts a container with the Continuum webapp deployed)
+
+Run Selenium tests in an alternate browser
+ * modify src/test/resources/testng.properties as needed
+ * mvn clean install -Dbrowser=iexplore (or -Dbrowser=safari or -Dbrowser=other -DbrowserPath=/path/to/browser)
+
Run Selenium tests in src/test/it with Maven, JUnit and Cargo
* modify src/test/resources/it.properties as needed
* mvn clean install -f junit-pom.xml
@@ -21,12 +31,6 @@
* for snapshot version of selenium(1.0-beta-SNAPSHOT), modify settings.xml/pom.xml to point to this repository http://nexus.openqa.org/content/repositories/snapshots
* mvn clean install -f junit-pom.xml
-Run Selenium tests against an existing Continuum instance
- * modify src/test/resources/it.properties as needed
- * mvn clean install -f junit-pom.xml -Dexisting-container
-
- (This skips the Cargo plugin configuration that starts a container with the Continuum webapp deployed)
-
Note that this does not install anything, it simply runs through the lifecycle including the integration test phases.
More properly it would be 'mvn clean post-integration-test', but install is much shorter to type. :)
Modified: continuum/trunk/continuum-webapp-test/pom.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/pom.xml?rev=770037&r1=770036&r2=770037&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/pom.xml (original)
+++ continuum/trunk/continuum-webapp-test/pom.xml Thu Apr 30 02:07:07 2009
@@ -82,95 +82,6 @@
</executions>
</plugin>
<plugin>
- <groupId>org.codehaus.cargo</groupId>
- <artifactId>cargo-maven2-plugin</artifactId>
- <version>1.0</version>
- <executions>
- <execution>
- <id>start-container</id>
- <phase>pre-integration-test</phase>
- <goals>
- <goal>start</goal>
- </goals>
- <configuration>
- <wait>false</wait>
- </configuration>
- </execution>
- <execution>
- <id>stop-container</id>
- <phase>post-integration-test</phase>
- <goals>
- <goal>stop</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <container>
- <containerId>${container.name}</containerId>
- <zipUrlInstaller>
- <url>${container.url}</url>
- <installDir>${project.build.directory}/installs/${container.name}</installDir>
- </zipUrlInstaller>
- <log>${project.build.directory}/logs/${container.name}.log</log>
- <output>${project.build.directory}/logs/${container.name}.out</output>
- <timeout>600000</timeout>
- <systemProperties>
- <appserver.base>${project.build.directory}</appserver.base>
- <derby.system.home>${project.build.directory}</derby.system.home>
- </systemProperties>
- <dependencies>
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derby</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.mail</groupId>
- <artifactId>mail</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.activation</groupId>
- <artifactId>activation</artifactId>
- </dependency>
- </dependencies>
- </container>
- <configuration>
- <home>${project.build.directory}/${container.name}</home>
- <type>standalone</type>
- <properties>
- <cargo.servlet.port>9595</cargo.servlet.port>
- <cargo.datasource.datasource.users>
- cargo.datasource.driver=org.apache.derby.jdbc.EmbeddedDriver|
- cargo.datasource.url=jdbc:derby:${project.build.directory}/databases/${container.name}/users;create=true|
- cargo.datasource.jndi=jdbc/users|
- cargo.datasource.username=sa
- </cargo.datasource.datasource.users>
- <cargo.datasource.datasource.builds>
- cargo.datasource.driver=org.apache.derby.jdbc.EmbeddedDriver|
- cargo.datasource.url=jdbc:derby:${project.build.directory}/databases/${container.name}/builds;create=true|
- cargo.datasource.jndi=jdbc/continuum|
- cargo.datasource.username=sa
- </cargo.datasource.datasource.builds>
- <cargo.resource.resource.mail>
- cargo.resource.name=mail/Session|
- cargo.resource.type=javax.mail.Session|
- cargo.resource.factory=org.apache.naming.factory.MailSessionFactory|
- cargo.resource.parameters=mail.smtp.host=localhost
- </cargo.resource.resource.mail>
- </properties>
- <deployables>
- <deployable>
- <groupId>${project.groupId}</groupId>
- <artifactId>continuum-webapp</artifactId>
- <type>war</type>
- <properties>
- <context>continuum</context>
- </properties>
- </deployable>
- </deployables>
- </configuration>
- </configuration>
- </plugin>
- <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
@@ -185,6 +96,14 @@
<goals>
<goal>test</goal>
</goals>
+ <configuration>
+ <systemProperties>
+ <property>
+ <name>browser</name>
+ <value>${browser}</value>
+ </property>
+ </systemProperties>
+ </configuration>
</execution>
</executions>
</plugin>
@@ -258,9 +177,112 @@
<profiles>
<profile>
+ <id>create-container</id>
+ <activation>
+ <property>
+ <name>!container</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-maven2-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <id>start-container</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ <configuration>
+ <wait>false</wait>
+ </configuration>
+ </execution>
+ <execution>
+ <id>stop-container</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <container>
+ <containerId>${container.name}</containerId>
+ <zipUrlInstaller>
+ <url>${container.url}</url>
+ <installDir>${project.build.directory}/installs/${container.name}</installDir>
+ </zipUrlInstaller>
+ <log>${project.build.directory}/logs/${container.name}.log</log>
+ <output>${project.build.directory}/logs/${container.name}.out</output>
+ <timeout>600000</timeout>
+ <systemProperties>
+ <appserver.base>${project.build.directory}</appserver.base>
+ <derby.system.home>${project.build.directory}</derby.system.home>
+ </systemProperties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.mail</groupId>
+ <artifactId>mail</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.activation</groupId>
+ <artifactId>activation</artifactId>
+ </dependency>
+ </dependencies>
+ </container>
+ <configuration>
+ <home>${project.build.directory}/${container.name}</home>
+ <type>standalone</type>
+ <properties>
+ <cargo.servlet.port>9595</cargo.servlet.port>
+ <cargo.datasource.datasource.users>
+ cargo.datasource.driver=org.apache.derby.jdbc.EmbeddedDriver|
+ cargo.datasource.url=jdbc:derby:${project.build.directory}/databases/${container.name}/users;create=true|
+ cargo.datasource.jndi=jdbc/users|
+ cargo.datasource.username=sa
+ </cargo.datasource.datasource.users>
+ <cargo.datasource.datasource.builds>
+ cargo.datasource.driver=org.apache.derby.jdbc.EmbeddedDriver|
+ cargo.datasource.url=jdbc:derby:${project.build.directory}/databases/${container.name}/builds;create=true|
+ cargo.datasource.jndi=jdbc/continuum|
+ cargo.datasource.username=sa
+ </cargo.datasource.datasource.builds>
+ <cargo.resource.resource.mail>
+ cargo.resource.name=mail/Session|
+ cargo.resource.type=javax.mail.Session|
+ cargo.resource.factory=org.apache.naming.factory.MailSessionFactory|
+ cargo.resource.parameters=mail.smtp.host=localhost
+ </cargo.resource.resource.mail>
+ </properties>
+ <deployables>
+ <deployable>
+ <groupId>${project.goupId}</groupId>
+ <artifactId>continuum-webapp</artifactId>
+ <type>war</type>
+ <properties>
+ <context>continuum</context>
+ </properties>
+ </deployable>
+ </deployables>
+ </configuration>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
<id>tomcat5x</id>
<activation>
- <activeByDefault>true</activeByDefault>
+ <property>
+ <name>!container</name>
+ </property>
</activation>
<properties>
<container.name>tomcat5x</container.name>
@@ -269,9 +291,21 @@
</properties>
</profile>
<profile>
+ <id>existing-container</id>
+ <activation>
+ <property>
+ <name>container</name>
+ <value>existing</value>
+ </property>
+ </activation>
+ <!-- edit src/test/resources/it.properties as needed -->
+ </profile>
+ <profile>
<id>firefox</id>
<activation>
- <activeByDefault>true</activeByDefault>
+ <property>
+ <name>!browser</name>
+ </property>
</activation>
<properties>
<browser>*firefox</browser>
@@ -279,12 +313,36 @@
</profile>
<profile>
<id>iexplore</id>
+ <activation>
+ <property>
+ <name>browser</name>
+ <value>iexplore</value>
+ </property>
+ </activation>
<properties>
<browser>*iexplore</browser>
</properties>
</profile>
<profile>
+ <id>safari</id>
+ <activation>
+ <property>
+ <name>browser</name>
+ <value>safari</value>
+ </property>
+ </activation>
+ <properties>
+ <browser>*safari</browser>
+ </properties>
+ </profile>
+ <profile>
<id>otherbrowser</id>
+ <activation>
+ <property>
+ <name>browser</name>
+ <value>other</value>
+ </property>
+ </activation>
<properties>
<browser>*custom ${browserPath}</browser>
</properties>
Modified: continuum/trunk/continuum-webapp-test/src/test/resources/testng.properties
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/resources/testng.properties?rev=770037&r1=770036&r2=770037&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/resources/testng.properties (original)
+++ continuum/trunk/continuum-webapp-test/src/test/resources/testng.properties Thu Apr 30 02:07:07 2009
@@ -14,7 +14,6 @@
SELENIUM_HOST=localhost
SELENIUM_PORT=4444
-SELENIUM_BROWSER=*firefox
DEFAULT_PROJ_GRP_NAME =Default Project Group
DEFAULT_PROJ_GRP_ID =default
Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractSeleniumTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractSeleniumTest.java?rev=770037&r1=770036&r2=770037&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractSeleniumTest.java (original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractSeleniumTest.java Thu Apr 30 02:07:07 2009
@@ -26,6 +26,8 @@
import java.util.Properties;
import java.util.Map.Entry;
+import org.codehaus.plexus.util.StringUtils;
+
import org.testng.Assert;
import com.thoughtworks.selenium.DefaultSelenium;
@@ -61,7 +63,13 @@
String seleniumHost = p.getProperty( "SELENIUM_HOST" );
int seleniumPort = Integer.parseInt( ( p.getProperty( "SELENIUM_PORT" ) ) );
- String seleniumBrowser = p.getProperty( "SELENIUM_BROWSER" );
+
+ String seleniumBrowser = System.getProperty( "browser" );
+ if ( StringUtils.isEmpty( seleniumBrowser ) )
+ {
+ seleniumBrowser = p.getProperty( "SELENIUM_BROWSER" );
+ }
+
final Selenium s = new DefaultSelenium( seleniumHost, seleniumPort, seleniumBrowser, baseUrl );
selenium = new ThreadLocal<Selenium>()
{