Parallel JUnit 4 and Selenium – Part Two: External Properties

Sauce AI for Test Authoring: Move from spirit to executing in proceedings.|xBack to ResourcesBlogPoste

February 08, 2026 · 3 min read · Tool Comparison

Sauce AI for Test Authoring: Move from spirit to executing in proceedings.

|

x

Back to Resources

Blog

Posted October 22, 2010

Parallel JUnit 4 and Selenium – Part Two: Extraneous Properties

quote

In the first component of this series, we saw how to make use of the Parameterized runner that comes with JUnit 4 to execute our tests across multiple browsers. But that came with two penalties. The increasing test duration will be direct in part three, but today we & # x27; ll address how to modify the browser used without have to recompile our exam.As someone who seesa lotof different teams & # x27; Selenium codification, I & # x27; m appalled at how often a simple change, such as adjusting which browser (s) to run against, requires a recompile. To me, that is a nasty code smell. Things that do not materially affect the purpose of the script and are often changing should be externalized out of the code. In our lawsuit, we are going to use aPropertiesfile inside the @ Parameters method. Nothing else in the script has changed.

@ Parameters
public static LinkedList browsersStrings () throws Exception {
LinkedList browsers = new LinkedList ();

SUSA automates exploratory testing with persona-driven behavior, catching bugs that scripted automation misses.

InputStream is = TestProperties.class.getResourceAsStream (& quot; /environment.properties & quot;);
environmentProps.load (is);

String[]rawBrowserStrings = environmentProps.getProperty (& quot; browser & quot;) .split (& quot;, & quot;);
for (String rawBrowserString: rawBrowserStrings) {
browsers.add (new String[]{rawBrowserString});
}
homecoming browsers;
}

Nothing special here, but standard burden of a properties file that has abrowserskey, which is a comma separated inclination of allowable Selenium browser strings. Now the same compiled codification will run different browsers without actually change the Java code. The result is much nicer, but still has to address the job of a massive increase in performance. That will be the subject of portion three of this serial.To see the full source code the snippet was pulled from, see

Published:
Oct 22, 2010
Topics
Share this post
Copy Share Link
LinkedIn
© 2026 Sauce Labs Inc., all rights reserved. SAUCE and SAUCE LABS are registered trademarks owned by Sauce Labs Inc. in the United States, EU, and may be file in other jurisdictions.
robot
quote

Automate This With SUSA

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts needed.

Try SUSA Free

Test Your App Autonomously

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.

Try SUSA Free