The Sauce Labs Cookbook

Sauce Headless

Front End Performance Testing

Insights

External Resources

More Info


Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Sauce Labs is a cloud platform for executing automated and manual mobile and web tests. Sauce Labs supports running automated tests with Selenium WebDriver (for web applications) and Appium (for native and mobile web applications). This topic will provide you with an example of how to get your Python tests up and running on Sauce.

Include Page
_setup_example_intro
_setup_example_intro

Include Page
_example_only
_example_only

...

Include Page
_python_requirements
_python_requirements

Code Example

Include Page
_pythonsetup_code_example_python_code_example

Tip
titleWait!

The explicit wait method tells the browser to wait a set amount of time (in seconds) for elements to appear on the page before giving up. Using explicit waits is one of our recommended best practices.

Analyzing the Code

If you look at the code closely, you'll see that basics for setting up a test to run on sauce are very straightforward, and really only require two elements.

...

Running the Test

  1. Copy the example code and save it into a file called first_test.py.
    Make sure your username and access key are included in the URL passed through to the command_executor.
  2. Open a command line terminal and navigate to the directory where the file is located.
  3. Execute the test:

    Code Block
    python first_test.py

    Check your dashboard and you will see that your test has just run on Sauce!

Running Local Tests

...

Running Tests in Parallel

...

For more information, check out the example scripts in our GitHub repo

Reporting on Test Results

Include Page
_python_reporting_python_reporting_script
_setup_example_script

Clone this script from the saucelabs-training GitHub repo: https://github.com/saucelabs-training/demo-python/blob/master/pytest/instant-sauce-pytest4.py

View Git file
pathpytest/instant-sauce-pytest4.py
repository-id36
branchrefs/remotes/origin/master