Health Check
Table of Contents
Overview
The following repository: https://github.com/saucelabs-training/demo-python, allows you to quickly run simple automated tests in order to validate your Python test environment with your saucelabs.com account credentials. Below are the steps to configure your test environment and run a simple automated test.
For Demonstration Purposes Only!
Disclaimer
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-examples
andheadless-examples
, may require a different account tier beyond free trial. Please contact the Sauce Labs Sales Team for support and information.
Solution Outline
- Tests that can help you quickly and easily get started with Sauce Labs
- Tests that use the Headless feature of Sauce Labs (not included with basic tier or free trial customers)
- Web Examples using Selenium on Sauce Labs
- Mobile Examples using Appium on Sauce Labs
Prerequisites
Before attempting an automated test, ensure you've installed the following software:
Use a Pre-built Workspace
If you want to skip the prerequisite setup, you can try this demo in a cloud-based IDE hosted by gitopd.io
After the session launches, navigate to the terminal and use the following commands to export your Sauce Labs credentials:
eval $(gp env -e SAUCE_USERNAME=******) eval $(gp env -e SAUCE_ACCESS_KEY=******)
Note: If you start a new session or terminal in gitpod you have to re-apply environment variables. For more information consult the gitpod documentation.eval $(gp env -e)
Install dependencies and run a python test:
pip install -r requirements.txt && / python on-boarding-modules/python-examples/test_module2.py
Sauce Labs Test Setup
Run the Onboarding Scripts
If you would like to get started with using Python and Sauce Labs with some guidance, please look at the Onboarding scripts provided in the on-boarding-modules
directory.
Run the Sauce Examples
In addition to onboarding, we have also included some samples of using Sauce Labs with some common Python test tools. In particular, we have examples using
- Pytest
- Robotframework
and these cover using
- Sauce Labs Virtual Device Cloud (VDC), which includes desktop browsers and emulator/simulator devices (EMUSIM)
- Sauce Labs Real Device Cloud (RDC).
These samples are executed using Pipenv for simplicity. You can find a list of available executions in the Pipfile for executing tests written in the test tools. These executions demonstrate how to run tests in parallel on the various Sauce Labs platforms.
The organization of these samples are as follows:
-- driver (appium or selenium) |- test tooling |- test environment (virtual or real devices) |- additional resources needed (if any) |- sample test framework
For example, to run tests with pytest
:
sudo pip install pipenv pipenv install pipenv run pytest-vdc-us