pytest-sosu

Unofficial PyTest plugin for Sauce Labs


Keywords
pytest, selenium, webdriver, saucelabs, sauce, sosu, automated-testing, python, selenium-webdriver, testing, testing-tools
License
Other
Install
pip install pytest-sosu==0.3.1

Documentation

Pytest-Sosu

Pytest-Sosu (pronounced Sōsu, ソース) is an unofficial Pytest plugin for running tests on Sauce Labs platforms.

Installation

You can install pytest-sosu latest version via pip:

pip install pytest-sosu

Basic Usage

Assuming you have SAUCE_USERNAME and SAUCE_ACCESS_KEY environment variables set (credentials can be obtained here), you can write a simple test:

def test_visit(sosu_selenium_webdriver):
    driver = sosu_selenium_webdriver
    driver.get("http://example.com/")
    assert driver.title == "Example Domain"

Examples

from pytest_sosu.webdriver import CapabilitiesMatrix, Browser


# running given test on multiple browsers
@pytest.mark.sosu(
    capabilities_matrix=CapabilitiesMatrix(
        browsers=[Browser("chrome"), Browser("firefox")],
    ),
)
def test_visit_many_browsers(driver):
    driver.get("http://example.com/")
    assert driver.title == "Example Domain"

# when build basename is set, tests running in given pytest session
# have a build assigned
@pytest.fixture(scope="session")
def sosu_build_basename():
    return 'my-project-name'


# alias for sosu_selenium_webdriver
@pytest.fixture
def driver(sosu_selenium_webdriver):
    yield sosu_selenium_webdriver