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
userNameandaccessKeyfrom 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, andAppium.WebDriverpackages. - .NET 6.0 or later.
- Access to an Android app, in
.apkor.aabformat, or an iOS app in.ipaformat.
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:
- Run the commands in the order shown, because
dotnet buildinstalls thebrowserstack-sdkcommand line tool, which the next command needs to run correctly. - The first
dotnet buildfails with awarning MSB3073and anerror MSB3371because thebrowserstack.ymlfile 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:
- Open the
browserstack.ymlfile. - Set your BrowserStack
userNameandaccessKey. - Set your
projectNameandbuildName. - Set
frameworktomstest. - Set
accessibilitytotrue. The default value isfalse. - Set
appto 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. - List every device, OS, and OS version you want to test under
platforms. - Set the accessibility testing options you need under
accessibilityOptions. For the full list, see Configuration options. - 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.
Run the automated test
From the root directory of your project, run the following command:
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.
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
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!