Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use selenium.yml for tunnel AND Selenium configuration.

Selenium.yml location configurable with -DseleniumConfigFilePath
Stanza within that file to use is configurable with -DseleniumEnvironment
Created new tasks in build_compile.xml: run_integration_tests_selenium_local/sauce.
  • Loading branch information...
commit 5b43cfae4f94af5294e1fc2a71aeeb779409c938 1 parent 6d09bfb
Chad Woolley & Sam Pierson authored
45 build.xml
View
@@ -83,6 +83,20 @@
description="Custom path to jsunit.jar file (e.g. if you want to use a Jar outside of lib/bin)."
/>
+ <property
+ id="seleniumConfigFilePath"
+ name="seleniumConfigFilePath"
+ value="${user.home}/selenium.yml"
+ description="Location of file containing selenium configuration options."
+ />
+
+ <property
+ id="seleniumEnvironment"
+ name="seleniumEnvironment"
+ value="local"
+ description="Stanza within seleniumConfigFile to use."
+ />
+
<property name="bin" location="java/bin"/>
<property name="lib" location="java/lib"/>
<property name="loggingPropertiesFile" location="logging.properties"/>
@@ -136,40 +150,15 @@
</junit>
</target>
- <target name="selenium_test" description="Runs tests on the local machine against selenium">
- <junit showoutput="true" haltonerror="true" haltonfailure="true">
- <formatter type="plain" usefile="false"/>
- <classpath refid="classpath"/>
- <sysproperty key="java.util.logging.config.file" value="${loggingPropertiesFile}"/>
- <sysproperty key="browserFileNames" value="${browserFileNames}"/>
- <sysproperty key="description" value="${description}"/>
- <sysproperty key="closeBrowsersAfterTestRuns" value="${closeBrowsersAfterTestRuns}"/>
- <sysproperty key="logsDirectory" value="${logsDirectory}"/>
- <sysproperty key="port" value="${port}"/>
- <sysproperty key="selenium.server.host" value="localhost"/>
- <sysproperty key="selenium.server.port" value="4444"/>
- <sysproperty key="selenium.browser.startCommand" value="*chrome /Applications/Firefox.app/Contents/MacOS/firefox-bin"/>
- <sysproperty key="selenium.browser.url" value="http://localhost:8080"/>
- <sysproperty key="resourceBase" value="${resourceBase}"/>
- <sysproperty key="timeoutSeconds" value="${timeoutSeconds}"/>
- <sysproperty key="url" value="${url}"/>
- <test name="net.jsunit.SeleniumTest"/>
- </junit>
- </target>
-
- <target name="selenium_sauce" description="Runs tests on the local machine against selenium">
+ <target name="selenium_test" description="Run tests through Selenium">
<junit showoutput="true" haltonerror="true" haltonfailure="true">
<formatter type="plain" usefile="false"/>
<classpath refid="classpath"/>
+ <sysproperty key="seleniumConfigFilePath" value="${seleniumConfigFilePath}"/>
+ <sysproperty key="seleniumEnvironment" value="${seleniumEnvironment}"/>
<sysproperty key="java.util.logging.config.file" value="${loggingPropertiesFile}"/>
- <sysproperty key="browserFileNames" value="${browserFileNames}"/>
<sysproperty key="description" value="${description}"/>
- <sysproperty key="closeBrowsersAfterTestRuns" value="${closeBrowsersAfterTestRuns}"/>
<sysproperty key="logsDirectory" value="${logsDirectory}"/>
- <sysproperty key="port" value="${port}"/>
- <sysproperty key="resourceBase" value="${resourceBase}"/>
- <sysproperty key="timeoutSeconds" value="${timeoutSeconds}"/>
- <sysproperty key="url" value="${url}"/>
<test name="net.jsunit.SeleniumTest"/>
</junit>
</target>
430 build_compile.xml
View
@@ -1,209 +1,223 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<project name="JsUnit Compilation" default="create_distribution" basedir=".">
-
- <!--
- This build file is used by developers of JsUnit. It is not packaged with the JsUnit binary distribution.
- -->
-
- <property name="source_core" location="java/source_core"/>
- <property name="source_server" location="java/source_server"/>
- <property name="source_aggregate" location="java/source_aggregate"/>
- <property name="source_services" location="java/source_services"/>
- <property name="tests_core" location="java/tests_core"/>
- <property name="tests_server" location="java/tests_server"/>
- <property name="tests_aggregate" location="java/tests_aggregate"/>
-
- <property name="bin" location="java/bin"/>
- <property name="lib" location="java/lib"/>
- <property name="testlib" location="java/testlib"/>
-
- <path id="classpath">
- <fileset dir="${lib}">
- <include name="*.jar"/>
- <include name="*/*.jar"/>
- </fileset>
- <fileset dir="${bin}">
- <include name="jsunit.jar"/>
- </fileset>
- </path>
-
- <target name="run_unit_tests" depends="clean,run_core_tests,run_server_tests,run_aggregate_tests"/>
-
- <path id="self_tests_classpath">
- <fileset dir="${lib}">
- <include name="*.jar"/>
- <include name="*/*.jar"/>
- </fileset>
- <fileset dir="${testlib}">
- <include name="*.jar"/>
- </fileset>
- </path>
-
- <path id="lib_classpath">
- <fileset dir="${lib}">
- <include name="*.jar"/>
- <include name="*/*.jar"/>
- </fileset>
- </path>
-
- <target name="run_core_tests" depends="compile_core_tests">
- <junit fork="yes" haltonfailure="false" forkmode="once" showoutput="yes" printsummary="withOutAndErr"
- failureproperty="junit_test_failed">
- <formatter type="plain" usefile="false"/>
- <classpath refid="self_tests_classpath"/>
- <classpath path="${bin}"/>
- <test name="net.jsunit.CoreUnitTestSuite"/>
- </junit>
- <fail if="junit_test_failed"/>
- </target>
-
- <target name="run_server_tests" depends="compile_server_tests">
- <junit fork="yes" haltonfailure="false" forkmode="once" showoutput="yes" printsummary="withOutAndErr"
- failureproperty="junit_test_failed">
- <formatter type="plain" usefile="false"/>
- <classpath refid="self_tests_classpath"/>
- <classpath path="${bin}"/>
- <test name="net.jsunit.ServerUnitTestSuite"/>
- </junit>
- <fail if="junit_test_failed"/>
- </target>
-
- <target name="run_aggregate_tests" depends="compile_aggregate_tests">
- <junit fork="yes" haltonfailure="false" forkmode="once" showoutput="yes" printsummary="withOutAndErr"
- failureproperty="junit_test_failed">
- <formatter type="plain" usefile="false"/>
- <classpath refid="self_tests_classpath"/>
- <classpath path="${bin}"/>
- <test name="net.jsunit.AggregateServerUnitTestSuite"/>
- </junit>
- <fail if="junit_test_failed"/>
- </target>
-
- <target name="clean">
- <delete file="jsunit.zip"/>
- <delete dir="${bin}/jsunit.jar"/>
- <delete dir="${bin}/jsunit_tests.jar"/>
- <delete dir="${bin}/net"/>
- </target>
-
- <target name="compile_source" depends="clean,compile_source_server,compile_source_aggregate"/>
-
- <target name="compile_tests_against_jar">
- <javac srcdir="${tests_core}" destdir="${bin}" debug="true">
- <classpath refid="self_tests_classpath"/>
- <classpath path="${bin}/jsunit.jar"/>
- </javac>
- <javac srcdir="${tests_server}" destdir="${bin}" debug="true">
- <classpath refid="self_tests_classpath"/>
- <classpath path="${bin}/jsunit.jar"/>
- </javac>
- <javac srcdir="${tests_aggregate}" destdir="${bin}" debug="true">
- <classpath refid="self_tests_classpath"/>
- <classpath path="${bin}/jsunit.jar"/>
- </javac>
- </target>
-
- <target name="compile_source_server" depends="compile_source_core">
- <javac srcdir="${source_server}" destdir="${bin}" debug="true">
- <classpath refid="lib_classpath"/>
- <classpath>
- <path location="${bin}"/>
- </classpath>
- </javac>
- </target>
-
- <target name="compile_source_aggregate" depends="compile_source_server">
- <javac srcdir="${source_aggregate}" destdir="${bin}" debug="true">
- <classpath refid="lib_classpath"/>
- <classpath>
- <path location="${bin}"/>
- </classpath>
- </javac>
- </target>
-
- <target name="compile_source_core">
- <javac srcdir="${source_core}" destdir="${bin}" debug="true">
- <classpath refid="lib_classpath"/>
- </javac>
- </target>
-
- <target name="compile_core_tests" depends="compile_source_core">
- <javac srcdir="${tests_core}" destdir="${bin}" debug="true">
- <classpath refid="self_tests_classpath"/>
- </javac>
- </target>
-
- <target name="compile_server_tests" depends="compile_source_server">
- <javac srcdir="${tests_server}" destdir="${bin}" debug="true">
- <classpath refid="self_tests_classpath"/>
- <classpath path="${bin}"/>
- </javac>
- </target>
-
- <target name="compile_aggregate_tests" depends="compile_source_aggregate">
- <javac srcdir="${tests_server}" destdir="${bin}" debug="true">
- <classpath refid="self_tests_classpath"/>
- <classpath path="${bin}"/>
- </javac>
- <javac srcdir="${tests_aggregate}" destdir="${bin}" debug="true">
- <classpath refid="self_tests_classpath"/>
- <classpath path="${bin}"/>
- </javac>
- </target>
-
- <target name="create_src_jar">
- <jar jarfile="./java/jsunit-source.jar">
- <fileset dir="${source_core}"/>
- <fileset dir="${source_server}"/>
- </jar>
- </target>
-
- <target name="generateJsUnitPropertiesSample" description="Generates the jsunit.properties.sample file">
- <xslt in="build.xml" out="jsunit.properties.sample" destdir="."
- style="tools/buildDotXmlToJsUnitDotProperties.xsl"></xslt>
- </target>
-
- <target name="make_jar" depends="compile_source">
- <jar jarfile="${bin}/jsunit.jar" basedir="${bin}" includes="net/**"/>
- <delete dir="${bin}/net"/>
- </target>
-
- <target name="make_tests_jar" depends="make_jar,compile_tests_against_jar">
- <jar jarfile="${bin}/jsunit_tests.jar" basedir="${bin}" includes="net/**"/>
- <delete dir="${bin}/net"/>
- </target>
-
- <target name="create_distribution" depends="clean,make_jar,create_zip"
- description="Creates the JsUnit distribution"/>
-
- <target name="create_zip">
- <zip destfile="jsunit.zip" filesonly="true">
- <zipfileset dir="." filemode="755" prefix="jsunit">
- <include name="bin/unix/*.sh"/>
- <include name="bin/mac/*.sh"/>
- </zipfileset>
- <zipfileset dir="." prefix="jsunit">
- <include name="**"/>
- <exclude name="bin/unix/*.sh"/>
- <exclude name="bin/mac/*.sh"/>
- <exclude name="**/.svn"/>
- <exclude name="**/*.java"/>
- <exclude name="uploaded/**"/>
- <exclude name="java/testlib/**"/>
- <exclude name="java/bin/jsunit_tests.jar"/>
- <exclude name="TEST-*.xml"/>
- <exclude name="**/*.class"/>
- <exclude name="logs/**"/>
- <exclude name="intellij/**"/>
- <exclude name="tools/**"/>
- <exclude name="build_compile.xml"/>
- <exclude name="JsUnit.ipr"/>
- <exclude name="JsUnit.iws"/>
- <exclude name="todo.txt"/>
- <exclude name="changelog.txt"/>
- </zipfileset>
- </zip>
- </target>
-
+<?xml version="1.0" encoding="utf-8"?>
+
+<project name="JsUnit Compilation" default="create_distribution" basedir=".">
+
+ <!--
+ This build file is used by developers of JsUnit. It is not packaged with the JsUnit binary distribution.
+ -->
+
+ <property name="source_core" location="java/source_core"/>
+ <property name="source_server" location="java/source_server"/>
+ <property name="source_aggregate" location="java/source_aggregate"/>
+ <property name="source_services" location="java/source_services"/>
+ <property name="tests_core" location="java/tests_core"/>
+ <property name="tests_server" location="java/tests_server"/>
+ <property name="tests_aggregate" location="java/tests_aggregate"/>
+
+ <property name="bin" location="java/bin"/>
+ <property name="lib" location="java/lib"/>
+ <property name="testlib" location="java/testlib"/>
+
+ <path id="classpath">
+ <fileset dir="${lib}">
+ <include name="*.jar"/>
+ <include name="*/*.jar"/>
+ </fileset>
+ <fileset dir="${bin}">
+ <include name="jsunit.jar"/>
+ </fileset>
+ </path>
+
+ <target name="run_unit_tests" depends="clean,run_core_tests,run_server_tests,run_aggregate_tests"/>
+
+ <target name="run_integration_tests_selenium_local">
+ <ant target="selenium_test">
+ <property name="seleniumConfigFilePath" value="./selenium.yml"/>
+ <property name="seleniumEnvironment" value="local"/>
+ </ant>
+ </target>
+
+ <target name="run_integration_tests_selenium_sauce">
+ <ant target="selenium_test">
+ <property name="seleniumConfigFilePath" value="./selenium.yml"/>
+ <property name="seleniumEnvironment" value="saucelabs"/>
+ </ant>
+ </target>
+
+ <path id="self_tests_classpath">
+ <fileset dir="${lib}">
+ <include name="*.jar"/>
+ <include name="*/*.jar"/>
+ </fileset>
+ <fileset dir="${testlib}">
+ <include name="*.jar"/>
+ </fileset>
+ </path>
+
+ <path id="lib_classpath">
+ <fileset dir="${lib}">
+ <include name="*.jar"/>
+ <include name="*/*.jar"/>
+ </fileset>
+ </path>
+
+ <target name="run_core_tests" depends="compile_core_tests">
+ <junit fork="yes" haltonfailure="false" forkmode="once" showoutput="yes" printsummary="withOutAndErr"
+ failureproperty="junit_test_failed">
+ <formatter type="plain" usefile="false"/>
+ <classpath refid="self_tests_classpath"/>
+ <classpath path="${bin}"/>
+ <test name="net.jsunit.CoreUnitTestSuite"/>
+ </junit>
+ <fail if="junit_test_failed"/>
+ </target>
+
+ <target name="run_server_tests" depends="compile_server_tests">
+ <junit fork="yes" haltonfailure="false" forkmode="once" showoutput="yes" printsummary="withOutAndErr"
+ failureproperty="junit_test_failed">
+ <formatter type="plain" usefile="false"/>
+ <classpath refid="self_tests_classpath"/>
+ <classpath path="${bin}"/>
+ <test name="net.jsunit.ServerUnitTestSuite"/>
+ </junit>
+ <fail if="junit_test_failed"/>
+ </target>
+
+ <target name="run_aggregate_tests" depends="compile_aggregate_tests">
+ <junit fork="yes" haltonfailure="false" forkmode="once" showoutput="yes" printsummary="withOutAndErr"
+ failureproperty="junit_test_failed">
+ <formatter type="plain" usefile="false"/>
+ <classpath refid="self_tests_classpath"/>
+ <classpath path="${bin}"/>
+ <test name="net.jsunit.AggregateServerUnitTestSuite"/>
+ </junit>
+ <fail if="junit_test_failed"/>
+ </target>
+
+ <target name="clean">
+ <delete file="jsunit.zip"/>
+ <delete dir="${bin}/jsunit.jar"/>
+ <delete dir="${bin}/jsunit_tests.jar"/>
+ <delete dir="${bin}/net"/>
+ </target>
+
+ <target name="compile_source" depends="clean,compile_source_server,compile_source_aggregate"/>
+
+ <target name="compile_tests_against_jar">
+ <javac srcdir="${tests_core}" destdir="${bin}" debug="true">
+ <classpath refid="self_tests_classpath"/>
+ <classpath path="${bin}/jsunit.jar"/>
+ </javac>
+ <javac srcdir="${tests_server}" destdir="${bin}" debug="true">
+ <classpath refid="self_tests_classpath"/>
+ <classpath path="${bin}/jsunit.jar"/>
+ </javac>
+ <javac srcdir="${tests_aggregate}" destdir="${bin}" debug="true">
+ <classpath refid="self_tests_classpath"/>
+ <classpath path="${bin}/jsunit.jar"/>
+ </javac>
+ </target>
+
+ <target name="compile_source_server" depends="compile_source_core">
+ <javac srcdir="${source_server}" destdir="${bin}" debug="true">
+ <classpath refid="lib_classpath"/>
+ <classpath>
+ <path location="${bin}"/>
+ </classpath>
+ </javac>
+ </target>
+
+ <target name="compile_source_aggregate" depends="compile_source_server">
+ <javac srcdir="${source_aggregate}" destdir="${bin}" debug="true">
+ <classpath refid="lib_classpath"/>
+ <classpath>
+ <path location="${bin}"/>
+ </classpath>
+ </javac>
+ </target>
+
+ <target name="compile_source_core">
+ <javac srcdir="${source_core}" destdir="${bin}" debug="true">
+ <classpath refid="lib_classpath"/>
+ </javac>
+ </target>
+
+ <target name="compile_core_tests" depends="compile_source_core">
+ <javac srcdir="${tests_core}" destdir="${bin}" debug="true">
+ <classpath refid="self_tests_classpath"/>
+ </javac>
+ </target>
+
+ <target name="compile_server_tests" depends="compile_source_server">
+ <javac srcdir="${tests_server}" destdir="${bin}" debug="true">
+ <classpath refid="self_tests_classpath"/>
+ <classpath path="${bin}"/>
+ </javac>
+ </target>
+
+ <target name="compile_aggregate_tests" depends="compile_source_aggregate">
+ <javac srcdir="${tests_server}" destdir="${bin}" debug="true">
+ <classpath refid="self_tests_classpath"/>
+ <classpath path="${bin}"/>
+ </javac>
+ <javac srcdir="${tests_aggregate}" destdir="${bin}" debug="true">
+ <classpath refid="self_tests_classpath"/>
+ <classpath path="${bin}"/>
+ </javac>
+ </target>
+
+ <target name="create_src_jar">
+ <jar jarfile="./java/jsunit-source.jar">
+ <fileset dir="${source_core}"/>
+ <fileset dir="${source_server}"/>
+ </jar>
+ </target>
+
+ <target name="generateJsUnitPropertiesSample" description="Generates the jsunit.properties.sample file">
+ <xslt in="build.xml" out="jsunit.properties.sample" destdir="."
+ style="tools/buildDotXmlToJsUnitDotProperties.xsl"></xslt>
+ </target>
+
+ <target name="make_jar" depends="compile_source">
+ <jar jarfile="${bin}/jsunit.jar" basedir="${bin}" includes="net/**"/>
+ <delete dir="${bin}/net"/>
+ </target>
+
+ <target name="make_tests_jar" depends="make_jar,compile_tests_against_jar">
+ <jar jarfile="${bin}/jsunit_tests.jar" basedir="${bin}" includes="net/**"/>
+ <delete dir="${bin}/net"/>
+ </target>
+
+ <target name="create_distribution" depends="clean,make_jar,create_zip"
+ description="Creates the JsUnit distribution"/>
+
+ <target name="create_zip">
+ <zip destfile="jsunit.zip" filesonly="true">
+ <zipfileset dir="." filemode="755" prefix="jsunit">
+ <include name="bin/unix/*.sh"/>
+ <include name="bin/mac/*.sh"/>
+ </zipfileset>
+ <zipfileset dir="." prefix="jsunit">
+ <include name="**"/>
+ <exclude name="bin/unix/*.sh"/>
+ <exclude name="bin/mac/*.sh"/>
+ <exclude name="**/.svn"/>
+ <exclude name="**/*.java"/>
+ <exclude name="uploaded/**"/>
+ <exclude name="java/testlib/**"/>
+ <exclude name="java/bin/jsunit_tests.jar"/>
+ <exclude name="TEST-*.xml"/>
+ <exclude name="**/*.class"/>
+ <exclude name="logs/**"/>
+ <exclude name="intellij/**"/>
+ <exclude name="tools/**"/>
+ <exclude name="build_compile.xml"/>
+ <exclude name="JsUnit.ipr"/>
+ <exclude name="JsUnit.iws"/>
+ <exclude name="todo.txt"/>
+ <exclude name="changelog.txt"/>
+ </zipfileset>
+ </zip>
+ </target>
+
</project>
BIN  java/lib/jyaml_1.3/jyaml-1.3.jar
View
Binary file not shown
0  java/lib/selenium-java-client-driver.jar → ...selenium_rc_1.0.1/selenium-java-client-driver.jar
View
File renamed without changes
0  java/lib/selenium-server.jar → java/lib/selenium_rc_1.0.1/selenium-server.jar
View
File renamed without changes
56 java/source_server/net/jsunit/SeleniumTest.java
View
@@ -7,6 +7,7 @@
import net.jsunit.configuration.CompositeConfigurationSource;
import net.jsunit.configuration.DelegatingConfigurationSource;
import net.jsunit.configuration.ServerConfiguration;
+import org.ho.yaml.Yaml;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -25,19 +26,15 @@
protected JsUnitServer server;
protected static Selenium selenium;
- protected static String SELENIUM_SERVER_HOST = "selenium.server.host";
- protected static String SELENIUM_SERVER_PORT = "selenium.server.port";
- protected static String SELENIUM_BROWSER_STARTCOMMAND = "selenium.browser.startCommand";
- protected static String SELENIUM_BROWSER_URL = "selenium.browser.url";
protected Process tunnel_process;
protected String tunnel_id;
protected HashMap<String, String> seleniumConfig;
public void setUp() throws Exception {
super.setUp();
- seleniumConfig = loadSeleniumConfig("../selenium.xml");
+ seleniumConfig = loadSeleniumConfig(System.getProperty("seleniumEnvironment"));
startJsUnitServer();
- if (seleniumConfig.get("host").equals("saucelabs.com")) {
+ if (seleniumConfig.get("selenium_server_address").equals("saucelabs.com")) {
startSauceTunnel();
}
startSeleniumClient();
@@ -45,7 +42,7 @@ public void setUp() throws Exception {
public void tearDown() throws Exception {
stopSeleniumClient();
- if (seleniumConfig.get("host").equals("saucelabs.com")) {
+ if (seleniumConfig.get("selenium_server_address").equals("saucelabs.com")) {
stopSauceTunnel();
}
stopJsUnitServer();
@@ -65,7 +62,7 @@ private void startSauceTunnel() throws IOException {
Matcher matcher = pattern.matcher(line);
if (matcher.find()) {
tunnel_id = matcher.group(1);
- seleniumConfig.put("browser_url", "http://" + matcher.group(2));
+ seleniumConfig.put("application_address", matcher.group(2));
break;
}
}
@@ -105,40 +102,15 @@ public void testStandaloneRun() throws Exception {
if (failCount + errorCount > 0) {
String errorMessages = selenium.getEval("window.mainFrame.mainErrors.document.getElementsByName('problemsList')[0].innerHTML");
System.out.printf("Error messages: %s\n", errorMessages);
-
}
assertEquals(0, failCount + errorCount);
}
- private HashMap<String, String> loadSeleniumConfig(String configPath) throws Exception {
- DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
- DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
- Document doc = docBuilder.parse(new File(configPath));
- doc.getDocumentElement().normalize();
- Element seleniumConfigElement = (Element) doc.getElementsByTagName("selenium_config").item(0);
- HashMap<String, String> seleniumProperties = new HashMap<String, String>();
-
- String host = System.getProperty(SELENIUM_SERVER_HOST);
- String port = System.getProperty(SELENIUM_SERVER_PORT);
- String start_command = System.getProperty(SELENIUM_BROWSER_STARTCOMMAND);
- String browser_url = System.getProperty(SELENIUM_BROWSER_URL);
-
- if (host == null) {
- host = seleniumConfigElement.getElementsByTagName("host").item(0).getFirstChild().getNodeValue();
- }
- if (port == null) {
- port = seleniumConfigElement.getElementsByTagName("port").item(0).getFirstChild().getNodeValue();
- }
- if (start_command == null) {
- start_command = seleniumConfigElement.getElementsByTagName("browser_start_command").item(0).getFirstChild().getNodeValue();
- }
- // If we are using saucelabs the browser_user will be automatically generated.
-
- seleniumProperties.put("host", host);
- seleniumProperties.put("port", port);
- seleniumProperties.put("browser_start_command", start_command);
- seleniumProperties.put("browser_url", browser_url);
- return seleniumProperties;
+ private HashMap<String, String>loadSeleniumConfig(String environment) throws Exception {
+ String seleniumConfigFilePath = System.getProperty("seleniumConfigFilePath");
+ HashMap<String, Object> environments = (HashMap<String, Object>)Yaml.load(new File(seleniumConfigFilePath));
+ HashMap<String, String> config = (HashMap<String, String>)environments.get(environment);
+ return config;
}
private void startJsUnitServer() throws Exception {
@@ -153,10 +125,10 @@ private void stopJsUnitServer() {
}
private void startSeleniumClient() throws Exception {
- String host = seleniumConfig.get("host");
- int port = Integer.parseInt(seleniumConfig.get("port"));
- String start_command = seleniumConfig.get("browser_start_command");
- String browser_url = seleniumConfig.get("browser_url");
+ String host = seleniumConfig.get("selenium_server_address");
+ int port = Integer.parseInt(seleniumConfig.get("selenium_server_port"));
+ String start_command = seleniumConfig.get("selenium_browser_key");
+ String browser_url = "http://" + seleniumConfig.get("application_address") + ":" + seleniumConfig.get("application_port");
selenium = new DefaultSelenium(host, port, start_command, browser_url);
selenium.start();
}
30 selenium.yml
View
@@ -0,0 +1,30 @@
+local:
+ selenium_server_address: "localhost"
+ selenium_server_port: "4444"
+ selenium_browser_key: "*chrome /Applications/Firefox.app/Contents/MacOS/firefox-bin"
+ application_address: "localhost"
+ application_port: "8080"
+
+# Possible Sauce Labs configurations as of 2009/11/19
+# From: http://saucelabs.com/products/docs/sauce-ondemand/browsers
+# os: "Windows 2003"
+# browser: "iexplore"
+# browser-version: "6.", "7.", "8."
+# browser: "firefox"
+# browser-version: "2.", "3.0", "3.5"
+# browser: "safari"
+# browser-version: "3.", "4."
+# browser: "opera"
+# browser-version: "9."
+# browser: "googlechrome"
+# browser-version: ""
+# os: "Linux"
+# browser: "firefox"
+# browser-version: "3."
+#
+saucelabs:
+ selenium_server_address: "saucelabs.com"
+ selenium_server_port: "4444"
+ selenium_browser_key: '{"username": "YOUR_SAUCELABS_USERNAME", "access-key": "YOUR_SAUCELABS_ACCESS_KEY", "os": "Linux", "browser": "firefox", "browser-version": "3."}'
+ # application_server is generated during tunnel setup
+ application_port: "80"
Please sign in to comment.
Something went wrong with that request. Please try again.