This directory contains example scripts and dependencies for Optimizing the Testing Experience with Analytics and the Sauce Lab REST API workshop. Use these scripts to test your Sauce Labs authentication credentials, setup your automated testing environment, try out Sauce Labs features, and complete the in-class examples. Download the zip file or clone the entire directory to your local environment.
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.
These procedures will show you to set up a Selenium environment for Java. The scripts in this repository allow you run a simple automated test to validate your Selenium environment and your saucelabs.com account credentials. In order to complete these exercises you must complete the following prerequisite installation and configuration steps:
- Install Git
- Install NPM
- Install an IDE (WebStorm, Atom etc.)
- Setup Project
- Install REST Client
Once your test environment is up and running, refer to the exercise guides to begin the exercises.
Git is a version control system that lets you check out code from a repository, work with that code on your own branch, and then merge that code with any changes that have been made by other developers. Git is an essential tool for distributed development teams, and is a critical component of the continuous integration/continuous development toolchain.
- Go to https://git-scm.com/downloads.
- Under Downloads, click Mac OS X.
- When the download completes, double-click the
.dmg
file open the installer package. - Double-click the installer package to begin the installation.
Security Warning
You may see a warning message that the package can't be opened because it's not from a recognized developer. If this happens, go to System Preferences > Security and Privacy Settings, and click Open Anyway.
- Click Continue for the installation, and enter your local password to authorize the installation.
- Go to https://git-scm.com/downloads
- Under Downloads, click on Windows.
- When the dialog opens asking if you want to allow the app to make changes to your device, click Yes.
- Follow the steps in the setup wizard to complete the installation. You should accept all the default settings.
NPM is the primary package manager that will help to resolve dependency issues.
- Go to https://www.npmjs.com/get-npm](https://www.npmjs.com/get-npm).
- Click the button that reads "Download Node.js and NPM.
- The site will detect which operating system you're currently running and present the requesite packages.
- Choose LTS, and open up the package to run the installer.
- Follow the prompts to complete the installation.
- To ensure NPM and Node.js installed correctly, open a terminal/shell and run the following command:
node -v npm -v
NodeJS lets you develop and deploy JavaScript applications on desktops and servers. If you which to download and install the package manually refer to the following instructions:
- Go to https://nodejs.org/en/download/.
- Under LTS, click Mac OS Installer X.
- When the download completes, double-click the
.pkg
file to open the installer - Follow the prompts to complete the installation.
- Go to https://nodejs.org/en/download/.
- Under LTS, click Windows Installer.
- When the download completes, double-click the
.msi
file to open the installer - Follow the prompts to complete the installation.
It's recommended to install and Integrated Developer Environment, or a text editor, to help manage package dependencies, interperters, and overall code execution. There are several options available, some of them are free and some require payment:
- Atom IDE free, IDE developed by GitHub.
- WebStorm free trial, paid after 30 days, developed by JetBrains.
- Komodo Edit, free, text editor, stripped down version of Komodo IDE (paid version).
- Brackets free, text editor, contains a wealth of community plugins and extensions.
-
Create a Project Directory:
- Create a directory on your computer's filesystem. You can create the directory using the IDE toolbar or the command line. Below is an example of using the command line to create your project directory:
mkdir saucecon2019-workshops
-
Import the Project:
- In your IDE and/or command line, navigate to the directory you just created
cd saucecon2019-workshops
- Clone the project repository from https://github.com/saucelabs-training/saucecon19-analytics-and-rest-api-workshop.
git clone https://github.com/saucelabs-training/saucecon19-analytics-and-rest-api-workshop
- Checkout branch
01_access_api
-
Initialize
package.json
-
Either in a command terminal or in the IDE, run
npm install
to download all dependencies/librariesnpm install
-
A RESTful client application can be helpful when trying to consume and modify API resources. In the workshop, we use Postman to send and consume API request/responses.