Skip to main content

pytest-stf PyPI version

pytest plugin for OpenSTF

Plugin for simplify OpenSTF usage with pytest framework by providing simple fixture that do all primitive tasks for appium based tests.

Target is to easily scale up tests in CI environment where external stf service is used to provide android phones.

Plugin based on stf-appium-python-client

pytest arguments

openstf:
  --stf_host=STF_HOST   Openstf host
  --stf_token=STF_TOKEN
                        Openstf access token
  --phone_requirements=PHONE_REQUIREMENTS
                        Phone requirements
  --stf_allocation_timeout=STF_ALLOCATION_TIMEOUT
                        Allocation timeout (how long time plugin waits for device)

Fixture selected_phone

is session scoped fixture that find out suitable android phone based on cli arguments, prepare remote adb connection and starts appium server that tests could utilize eventually.

NOTE: appium need to be installed separately! (npm i appium) .

NOTE: only one phone is handled by this fixture.

Usage example

Test script: sample.py

from appium.webdriver.webdriver import WebDriver


def test_create(appium_client):
    client, appium, adb, phone = appium_client
    # device is dictionary of device metadata
    # adb: AdbServer instance, that is already connected
    # appium: AppiumServer instance that provide server address for appium client
    print(phone)
    print(f'wd_hub: {appium.get_api_path()}')
    
    client: WebDriver
    client, *_ = appium_client
    URL = 'https://google.com'
    client.get(URL)
    url = client.current_url
    assert url == URL, 'Wrong URL'

Execution

> pytest sample/test_samples.py --stf_host localhost --stf_token $TOKEN --phone_requirements platform=Android

See more examples from sample/test_samples.py.

custom capabilities:

> pytest --appium_capabilities cab=val1&cab=val2

Metadata

Release files for pytest-stf 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-stf 0.2.0
File Size Uploaded Provenance Actions
pytest-stf-0.2.0.tar.gz 6.7 kB Without provenance Details for pytest-stf-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pytest-stf 0.2.0
File Interpreter ABI Platform Actions
pytest_stf-0.2.0-py3-none-any.whl Python 3 none any Details for pytest_stf-0.2.0-py3-none-any.whl

Total release size: 11.0 kB

Release files / pytest-stf-0.2.0.tar.gz

Download URL pytest-stf-0.2.0.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
cb5b461fca3fe15a30a1ac57ccdf1f7bd9d9a2056865e1a167154285f96c2c0b
BLAKE2b-256 checksum
How to use checksums
e13a735fa222854abf4f302e6719ffb6e6fa9617ef702bebd40a3ecc917831fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release files / pytest_stf-0.2.0-py3-none-any.whl

Download URL pytest_stf-0.2.0-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1bcc533a8f7252462a08056a2773f98ec3b7418b01a5b9d2cf88afe66ebd2395
BLAKE2b-256 checksum
How to use checksums
0e8b78fed86aaca1f02b737f20b6ac70c94fb72cafb40e06ef3b3e0dee015d77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Security for pytest-stf 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page