Run accessibility checks on the MSTest sample repository
Run automated App Accessibility checks on real devices using the BrowserStack sample MSTest repository.
BrowserStack App Automate supports running MSTest tests on a wide range of real Android and iOS devices. Use the BrowserStack sample repository to run your first MSTest build with accessibility checks enabled.
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. - .NET 6.0 or later.
Run a sample build
Set your BrowserStack credentials
The sample project reads your credentials from environment variables. Save your credentials so you can run the 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
Navigate to the platform directory
The sample project holds a separate directory and configuration file for each platform. Based on the platform you want to test, navigate to the corresponding directory.
Update the BrowserStack SDK
From the platform directory, run the following command to update the SDK to the current version.
The sample project pins an older BrowserStack.TestAdapter version that doesn’t work on current .NET runtimes. Without this command, the project still builds, but the test run stops with a HarmonyException before reaching BrowserStack. This command updates the adapter and the browserstack-sdk command line tool to the current version.
Modify the configuration file
Each platform directory has its own browserstack.yml file, which defines the capabilities used to run your tests on BrowserStack. Edit the file in your platform directory, as follows:
- Open the
browserstack.ymlfile. - Set
frameworktomstest. - Set
accessibilitytotrue. The default value isfalse. - Set
browserstackLocaltofalse. The sample project setsbrowserstackLocaltotruefor its Local Testing example, which accessibility tests don’t use. - If you’re running Android tests, delete the
nameproperty. The Android.ymlfile setsname: BStack android test, which the SDK sends to BrowserStack as a capability. BrowserStack rejects that capability, and your test session never starts. - Check every device and OS version under
platformsagainst the list of supported devices, and replace any that BrowserStack no longer offers. The sample project pins older combinations, and one unsupported entry fails the whole run. - 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 sample test
From the platform directory, run the following command:
The SingleTest filter runs the sample accessibility test. The sample project also includes a Local Testing example, which needs a BrowserStack Local tunnel and isn’t part of this guide.
The sample project was built for .NET 6, so .NET requires the .NET 6 runtime to run the project. Without that runtime, the run stops with a Framework: 'Microsoft.NETCore.App', version '6.0.0' error before the test reaches BrowserStack. Setting DOTNET_ROLL_FORWARD to Major runs the project on the newest runtime you have, so you don’t need to install .NET 6.
View the accessibility test report
After the test run completes, open the App Accessibility dashboard to review the violations found in each scan.
Next steps
To add accessibility checks to your own test suite, see Integrate MSTest test suite with App Accessibility testing.
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!