Skip to content

Integration with Cloud Services

Indira Nellutla edited this page Mar 5, 2018 · 16 revisions

Integration with Cloud Services

BrowserStack

To run your automated tests using BrowserStack, you must provide a valid username, access key, and parameter called REMOTE_BROWSER_PLATFROM. These parameters are fetched from the remote_credentials.py configuration file in our framework. You can set REMOTE_BROWSER_PLATFROM to 'BS' to run on BrowserStack. Refer to our post on Get started with BrowserStack if you are new to BrowserStack.

We configured py.test to run tests on BrowserStack by providing fixtures for command line parameters like the browser, the browser version, the operating system, the operating system version. These fixtures are stored in conftest.py file as shown below.

@pytest.fixture
def remote_flag():
    "pytest fixture for browserstack/sauce flag"
    return pytest.config.getoption("-M")

You can follow the step by step guide and the detailed code samples given in our post How to configure py.test to work with BrowserStack for configuring py.test to work with BrowerStack.

In case you want to run the test in remote, use command line option '-M' in the py.test. For Example:- If you want to run example test shown above on OS X Yosemite using a Chrome browser use the below command: py.test -B chrome -V 50 -P "OS X" -O Yosemite -M y

Sauce Labs

In case you want to run automated tests using Sauce Labs, you can set REMOTE_BROWSER_PLATFROM to 'SL'. You can also configure py.test to run tests on Sauce Labs. You can simply add details like the browser, the browser version, the operating system, the operating system version as command line parameters to py.test. py.test -B chrome -V 50 -M y. For more details, refer our blog posts Running Selenium automation using Sauce Labs: Part 1,Part 2 and Part 3