[MRM-1164] Allow command line configuration of which browser to use, for example -Dbrowser=iexplore

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@770871 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Wendy Smoak 2009-05-02 00:38:38 +00:00
parent 6f0984adf3
commit 4cfc5a7837
2 changed files with 47 additions and 5 deletions

View File

@ -26,6 +26,8 @@ import java.util.Map;
import java.util.Properties;
import java.util.Map.Entry;
import org.codehaus.plexus.util.StringUtils;
import org.testng.Assert;
import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.Selenium;
@ -56,7 +58,13 @@ public abstract class AbstractSeleniumTest {
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>()
{

View File

@ -172,6 +172,14 @@
<goals>
<goal>test</goal>
</goals>
<configuration>
<systemProperties>
<property>
<name>browser</name>
<value>${selenium.browser}</value>
</property>
</systemProperties>
</configuration>
</execution>
</executions>
</plugin>
@ -364,22 +372,48 @@
<profile>
<id>firefox</id>
<activation>
<activeByDefault>true</activeByDefault>
<property>
<name>!browser</name>
</property>
</activation>
<properties>
<browser>*firefox</browser>
<selenium.browser>*firefox</selenium.browser>
</properties>
</profile>
<profile>
<id>iexplore</id>
<activation>
<property>
<name>browser</name>
<value>iexplore</value>
</property>
</activation>
<properties>
<browser>*iexplore</browser>
<selenium.browser>*iexplore</selenium.browser>
</properties>
</profile>
<profile>
<id>safari</id>
<activation>
<property>
<name>browser</name>
<value>safari</value>
</property>
</activation>
<properties>
<selenium.browser>*safari</selenium.browser>
</properties>
</profile>
<profile>
<id>otherbrowser</id>
<activation>
<property>
<name>browser</name>
<value>other</value>
</property>
</activation>
<properties>
<browser>*custom ${browserPath}</browser>
<selenium.browser>*custom ${browserPath}</selenium.browser>
</properties>
</profile>
</profiles>