Integrate TestNG test suite with app accessibility testing
Learn how to add accessibility checks to your existing functional tests and generate comprehensive reports of accessibility issues.
Integrate your functional test suites with App Accessibility Automate to run accessibility checks on your mobile apps and access detailed accessibility violation reports on the App Accessibility dashboard, ensuring your applications meet accessibility standards.
For Android devices, App Accessibility automated tests are supported on version 11 and above.
Prerequisites
- You must have a BrowserStack account (a free trial works). Obtain your
username
andaccess key
from Account & Profile section. - Ensure you have a functional TestNG test suite integrated with BrowserStack Automate.
- Install Maven or Gradle on your machine. Set their environment variables and add their
bin
directories to the system$PATH
. - You require the following software versions:
- TestNG v6.8 or higher
- Java v8 or higher (Java 9 or higher is required for Gradle)
Integrate App Accessibility Automate to run accessibility checks
Follow these steps to add automated accessibility checks to your test suite:
Install or update your SDK
Install the SDK or update the SDK to the latest version.
The minimum version of browserstack-java-sdk
that supports Automated tests is 1.30.5
.
Follow these steps to install BrowserStack SDK.
Maven Archetype provides a template to quickly configure your project. Copy & run the below command on your terminal/command prompt to add browserstack-java-sdk
dependency in your pom.xml
and browserstack.yml
config file in your project.
Follow these steps to update your BrowserStack SDK.
- Update your
pom.xml
file to include the latest version of the BrowserStack SDK:
- Run the following command within your test suite folder from the terminal to update to the latest SDK version:
Configure the browserstack.yml
file
The browserstack.yml
file contains all required capabilities to run your tests on BrowserStack. It’s located in your project’s Android or iOS root folder and is included as part of the sample repository.
- Open the
browserstack.yml
file. - Set the
userName
andaccessKey
. - Set the
framework
:- Set it to
testng
if you want to run only TestNG tests. - Set it to
cucumber-testng
if you want to run Cucumber tests using TestNG as the test runner.
- Set it to
- Set the
accessibility
flag totrue
. The default value isfalse
. - Set the
accessibilityOptions
property to configure various accessibility testing options. For details, see Configuration options. - Set the relative or absolute path of the app you want to test in the
app
property. For example,app: ./examples/BStackSampleApp.apk
. You can upload an Android app (.apk or .aab) or an iOS app (.ipa) from your local filesystem. - Specify all the device, OS, and OS version combinations that you want to test in the
platforms
section. - Set the
projectName
andbuildName
.
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
Continue running your tests as you have been running previously. The command to run your tests using the BrowserStack SDK remains unchanged. For your reference, here is a sample command:
After the test completes, access the report in your project folder on the 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
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!