Skip to main content
No Result Found

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 and access 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:

Set BrowserStack credentials

Saving your BrowserStack credentials as environment variables makes it easier to run your test suite.

Copy icon Copy
Copy icon Copy

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.

Copy icon Copy
Copy icon Copy

Follow these steps to update your 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

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.

  1. Open the browserstack.yml file.
  2. Set the userName and accessKey.
  3. 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.
  4. Set the accessibility flag to true. The default value is false.
  5. Set the accessibilityOptions property to configure various accessibility testing options. For details, see Configuration options.
  6. 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.
  7. Specify all the device, OS, and OS version combinations that you want to test in the platforms section.
  8. Set the projectName and buildName.

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

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:

Copy icon Copy

After the test completes, access 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