Skip to main content
Experience faster, smarter testing with BrowserStack AI Agents. See what your workflow’s been missing. Explore now!
No Result Found
Connect & Get help from fellow developers on our Discord community. Ask the CommunityAsk the Community

Run accessibility checks on a Pytest sample repo

Prerequisites

  • Ensure you have a BrowserStack Username and Access Key. You can obtain your username and access key from the Account & Profile section on the dashboard.
    If you have not yet created an account, sign up for a free trial.
  • Python3 and Pip3 are installed on your machine.

Run a sample build

Run a sample Pytest test build using BrowserStack SDK with the following steps:

Clone the sample test repository

Clone the sample Git repository using the following commands.

git clone https://github.com/browserstack/pytest-appium-app-browserstack

Set up the Python virtual environment

Navigate to the sample project directory and create a Python virtual environment.

cd pytest-appium-app-browserstack
python3 -m venv env
source env/bin/activate
pip3 install -r requirements.txt
cd pytest-appium-app-browserstack
python3 -m venv env
.\env\Scripts\Activate.ps1
pip3 install -r requirements.txt

Update the BrowserStack SDK

If you have not already done so, update the BrowserStack SDK to the latest version.

The minimum supported BrowserStack SDK version is 1.30.0.

pip install --upgrade browserstack-sdk

Based on your testing platform, navigate to the Android or iOS directory.

cd pytest-appium-app-browserstack/android
cd pytest-appium-app-browserstack/ios

Configure the browserstack.yml file

The browserstack.yml file contains the necessary capabilities to run your tests on BrowserStack. It is platform-specific and located in the relevant platform folder (android/ or ios/). Make sure you modify the file that corresponds to your testing platform.

  1. Open the browserstack.yml file in an editor.
  2. Add your userName and accessKey.
  3. Set the accessibility flag to true. The default value is false.
  4. Set the framework to pytest.
  5. Save the file.

The projectName and buildName config must be static and not change across different runs of the same build. This is a deviation in approach as specified by BrowserStack App Automate since Automated tests will automatically identify different build runs.

userName: YOUR_USERNAME
accessKey: YOUR_ACCESS_KEY
projectName: BrowserStack Samples
buildName: browserstack build
buildIdentifier: '#${BUILD_NUMBER}'
app: ./BStackSampleApp.ipa
framework: pytest
platforms:
  - deviceName: iPhone 14
    osVersion: 16
    platformName: ios
  - deviceName: iPhone 12
    osVersion: 17
    platformName: ios
parallelsPerPlatform: 2
accessibility: true
browserstackLocal: false
debug: false
networkLogs: false
consoleLogs: errors

Run the sample test

In the platform folder, run the following command to execute the sample test.

browserstack-sdk pytest -s bstack_sample.py

Next steps

Integrate Accessibility testing into App Automate.

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback!

Talk to an Expert
Download Copy Check Circle