Skip to main content
No Result Found
Connect & Get help from fellow developers on our Discord community. Ask the CommunityAsk the Community

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.

BrowserStack supports out-of-the-box integration with Cucumber tests using TestNG as a test runner. You can integrate your existing functional test suites with App Accessibility testing to run accessibility checks on mobile apps. You can access 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

Integrate App Accessibility Automate to run accessibility checks

Set your BrowserStack credentials

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

Copy icon Copy
Copy icon Copy

Install or update the BrowserStack SDK

The minimum supported BrowserStack SDK version is 1.29.0.

Install the BrowserStack SDK using the Maven Archetype, which provides a template to quickly configure your project.

  • Run the following command to add the browserstack-java-sdk dependency to the pom.xml and the browserstack.yml configuration files of your project.
Copy icon Copy
Copy icon Copy

Follow these steps to update the BrowserStack SDK.

  • Update your pom.xml file to include the latest version of the BrowserStack SDK:
Copy icon Copy
  • Run the following command within your test suite folder from the terminal to update to the latest SDK version:
Copy icon Copy
  • Add the SDK dependency in your build.gradle file:
Copy icon Copy
  • Run the following command within your test suite folder from the terminal to update to the latest SDK version:
Copy icon Copy

Modify the configuration file

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

  1. Open the browserstack.yml file.
  2. Set the userName and accessKey.
  3. Set the framework to cucumber-testng.
  4. Set the accessibility flag to true. By default, the flag is set to false.
  5. Configure the accessibilityOptions property to set various accessibility testing options. For details, see Configuration options.
  6. Add 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 file) or an iOS app (.ipa file) from your local filesystem.
  7. Specify all the device, OS, and OS version combinations that you want to test in the platforms section.
  8. Add the projectName and buildName.
  9. 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.

browserstack.yml
Copy icon Copy

Run the automated test

From your platform folder (Android or iOS), run the following command:

 mvn test -P sample-test

View the Accessibility test report

After the test completes, view the report in your project folder on the App Accessibility dashboard.


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