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.

...

Include Page
_setup_example_script
_setup_example_script

Clone You can clone this script from the the saucelabs-training repository on GitHub repohttps://github.com/saucelabs-training/demo-python

Info

There are examples using both pytest and unittest frameworks, change directories to the relevant module before running your tests:

...

...

  • on-boarding-modules/unittest-examples/test_module4_unittest.py
    repository-id36
    titletest_module4_unittest.py
    branchrefs/remotes/origin/master

Testing with a Proxy

If you're trying to run this script from behind a VPN or a corporate proxy, you must use either IPSec or Sauce Connect Proxy. Once you've downloaded and installed the relevant software, add the following capability to the test script:

Code Block
'tunnelIdentifier': '<tunnel_id>',

Running the Test

  1. Navigate to the root project directory and use pip to install the latest Selenium library for use in the script:

    Code Block
    $ pip install -r requirements.txt
  2. Set your Sauce Labs Credentials as envrionment variables, indicated by the following lines in the script:

    View Git file
    pathon-boarding-modules/pytest-examples/test_module4_pytest.py
    lastline9
    repository-id36
    firstline8
    branchrefs/remotes/origin/master
  3. Depending on which framework you're using, your commands may be different to run the tests. Use any of the following command based on the chosen framework:

    pytest:

    Code Block
    pytest on-boarding-modules/pytest-examples/test_module4_pytest.py

    unittest:

    Code Block
     python -m unittest on-boarding-modules/unittest-examples/test_module4_unittest.py