Skip to main content
🎉 A11y Issue Detection Agent is now live! Detect accessibility issues like a WCAG expert with AI. Try now!
No Result Found
Get your setup working faster. Join our Discord for optimisation tips from elite testers. Join our DiscordJoin our Discord

Integrate MSTest test suite with App Accessibility testing

Learn how to add accessibility checks to your existing MSTest tests and generate comprehensive reports of accessibility issues.

MSTest is the Microsoft test framework for .NET. BrowserStack App Accessibility supports MSTest suites on a wide range of real Android and iOS devices. You can add accessibility checks to your existing functional test suite and review the generated accessibility violation reports on the App Accessibility dashboard.

For Android devices, automated App Accessibility testing is supported on version 11 and above.

Prerequisites

  • Ensure you have a BrowserStack Username and Access Key. Obtain your userName and accessKey from the Account & Profile section on the dashboard.
    If you have not yet created an account, sign up for a free trial.
  • An existing MSTest test suite for your mobile app.
  • Your project references the MSTest.TestFramework, MSTest.TestAdapter, and Appium.WebDriver packages.
  • .NET 6.0 or later.
  • Access to an Android app, in .apk or .aab format, or an iOS app in .ipa format.

Integrate App Accessibility Automate to run accessibility checks

Set your BrowserStack credentials

Save your BrowserStack credentials as environment variables to run your test suite from your local or CI environment.

Set the following values in either your Zsh (~/.zprofile) or Bash (~/.profile) shell configuration file.

export BROWSERSTACK_USERNAME=YOUR_USERNAME
export BROWSERSTACK_ACCESS_KEY=YOUR_ACCESS_KEY

Install the BrowserStack SDK

From the root directory of your project, run the following commands to add the BrowserStack SDK and create a browserstack.yml file:

Copy icon Copy
  • Run the commands in the order shown, because dotnet build installs the browserstack-sdk command line tool, which the next command needs to run correctly.
  • The first dotnet build fails with a warning MSB3073 and an error MSB3371 because the browserstack.yml file doesn’t exist yet. The tool is still installed, so run the next command. Later builds succeed after you create the configuration file.

Modify the configuration file

The setup command creates a browserstack.yml file configured for desktop browser testing, so replace its contents to test an app on real devices. Edit the file as follows:

  1. Open the browserstack.yml file.
  2. Set your BrowserStack userName and accessKey.
  3. Set your projectName and buildName.
  4. Set framework to mstest.
  5. Set accessibility to true. The default value is false.
  6. Set app to the relative or absolute path of the app you want to test, such as ./BStackSampleApp.apk. The SDK uploads the app and reuses it in later runs.
  7. List every device, OS, and OS version you want to test under platforms.
  8. Set the accessibility testing options you need under accessibilityOptions. For the full list, see Configuration options.
  9. Save the file.

To auto-generate screen reader testing reports for your app’s workflow, set the screenReaderAutomationReport flag to true under accessibilityOptions.

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.

browserstack.yml
Copy icon Copy

Run the automated test

From the root directory of your project, run the following command:

Copy icon Copy

To run a subset of your tests, add the --filter argument to the command.

View the accessibility test report

After the test run completes, open the App Accessibility dashboard to review the violations found in each scan.


Visit App Accessibility dashboard

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