The demo scripts in this repository allow you to run simple automated tests in order to validate your Java Selenium environment and your saucelabs.com account credentials.
The code in these scripts is provided on an "AS-IS" basis without warranty of any kind, either express or implied, including without limitation any implied warranties of condition, uninterrupted use, merchantability, fitness for a particular purpose, or non-infringement. These scripts are provided for educational and demonstration purposes only, and should not be used in production. Issues regarding these scripts should be submitted through GitHub. These scripts are maintained by the Technical Services team at Sauce Labs.
Some examples in this repository, such as
appium-example
,parallel-testing
, andheadless
, may require a different account tier beyond free trial. Please contact the Sauce Labs Sales Team for support and information.
- Tests that can help you quickly and easily get started with Sauce Labs
- Advanced tests that use test automation best practices on Sauce Labs
- W3C examples using Sauce Labs
- Tests that use the Headless feature of Sauce Labs
- Mobile Examples using Appium on Sauce Labs
- Install Git
- Install IntelliJ (or another IDE)
- Install JDK
- Install Maven
Select the button below to try this demo in Gitpod
Click here to see how to setup your Sauce Labs credentials in Gitpod
- Create a directory on your machine.
- Clone this repository into said directory.
$ git clone https://github.com/saucelabs-training/demo-java.git
- Import the project into your IntelliJ (or IDE of your choice) as a Maven Project.
- Click through the prompts, and confirm when it asks to Import from Sources
- Choose the demo-java directory as the root directory of the project.
-
Copy your Sauce Labs username and accessKey in the User Settings section of the Sauce Labs Dashboard.
-
Open a Terminal window (command prompt for Windows) and set your Sauce Labs Environment variables:
$ export SAUCE_USERNAME="username" $ export SAUCE_ACCESS_KEY="accessKey"
> set SAUCE_USERNAME="username" > set SAUCE_ACCESS_KEY="accessKey"
To set an environment variables permanently in Windows, you must append it to the
PATH
variable.Go to Control Panel > System > Windows version > Advanced System Settings > Environment Variables > System Variables > Edit > New
Then set the "Name" and "Value" for each variable
-
Test the environment variables
$ echo $SAUCE_USERNAME $ echo $SAUCE_ACCESS_KEY
WARNING FOR UNIX USERS!: If you have problems setting your environment variables, run the following commands in your terminal:
$ launchctl setenv SAUCE_USERNAME $SAUCE_USERNAME $ launchctl setenv SAUCE_ACCESS_KEY $SAUCE_ACCESS_KEY
> echo %SAUCE_USERNAME% > echo %SAUCE_ACCESS_KEY%
-
Run the following command to update any package dependencies:
$ mvn dependency:resolve
-
Then run the following command to compile your test code:
$ mvn test-compile
-
Finally, run the following test to see if you've properly configured the test environment:
$ mvn test -Dtest=Module2TestNGTest -pl on-boarding-modules/testng
If you wish to run a specific test/sub-module in this emusim_testng use the following command:
# for running a specific test: mvn test -Dtest=testname # for running a specific sub-module mvn test -pl subproject/