Skip to content

Commit 1fc1ed6

Browse files
NeilNeil
Neil
authored and
Neil
committed
Using conditional to see if SAUCE_USERNAME exists
1 parent 6c2e9c5 commit 1fc1ed6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/test/java/com/yourcompany/SampleSauceTest.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,14 @@
4040
@Listeners({SauceOnDemandTestListener.class})
4141
public class SampleSauceTest implements SauceOnDemandSessionIdProvider, SauceOnDemandAuthenticationProvider {
4242

43+
public String username = System.getenv("SAUCE_USERNAME") != null ? System.getenv("SAUCE_USERNAME") : System.getenv("SAUCE_USER_NAME");
44+
public String accesskey = System.getenv("SAUCE_ACCESS_KEY") != null ? System.getenv("SAUCE_ACCESS_KEY") : System.getenv("SAUCE_API_KEY");
45+
4346
/**
44-
* Constructs a {@link com.saucelabs.common.SauceOnDemandAuthentication} instance using the supplied user name/access key. To use the authentication
45-
* supplied by environment variables or from an external file, use the no-arg {@link com.saucelabs.common.SauceOnDemandAuthentication} constructor.
47+
* Constructs a {@link SauceOnDemandAuthentication} instance using the supplied user name/access key. To use the authentication
48+
* supplied by environment variables or from an external file, use the no-arg {@link SauceOnDemandAuthentication} constructor.
4649
*/
47-
public SauceOnDemandAuthentication authentication = new SauceOnDemandAuthentication(System.getenv("SAUCE_USERNAME"), System.getenv("SAUCE_ACCESS_KEY"));
50+
public SauceOnDemandAuthentication authentication = new SauceOnDemandAuthentication(username, accesskey);
4851

4952
/**
5053
* ThreadLocal variable which contains the {@link WebDriver} instance which is used to perform browser interactions with.

0 commit comments

Comments
 (0)