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

Run accessibility checks on a JUnit 5 sample repo

Try out App Accessibility Automation with BrowserStack’s sample repository.

BrowserStack App Automate supports running JUnit 5 tests on a wide range of real Android and iOS devices. You can integrate your existing JUnit 5 test suites with App Automate to run accessibility checks on your mobile apps.
This guide helps you run your first JUnit 5 test build on a real Android or iOS device on BrowserStack.

Prerequisites

  • Ensure you have a BrowserStack Username and Access Key. Obtain your userName and accessKey from the Account & Profile section on the dashboard.
    If you have not yet created an account, sign up for a free trial.
  • Java 8 or higher is installed on your system.
  • If you use the CLI to run tests, make sure that Apache Maven is installed on your system, the Maven environment variables are set, and the Maven bin directory is added to the system path ($PATH) if you are using macOS or Linux systems.
  • Appium is installed on your system.

Run a sample build

Get the sample project

Get the BrowserStack sample JUnit 5 project using one of the following options:

Option 1: Download repository

Download the sample JUnit 5 repository to your system.

Option 2: Clone repository

Clone the sample Git repository using the following command:

git clone -b master https://github.com/browserstack/junit5-appium-app-browserstack.git

Option 3: Use Maven archetype

Set up a new sample project using the Maven archetype. The following command creates a project with your BrowserStack credentials preconfigured.
Replace YOUR_USERNAME and YOUR_ACCESS_KEY with your BrowserStack credentials, and run one of the following commands based on your operating system:

mvn archetype:generate -B -DarchetypeGroupId=com.browserstack \
-DarchetypeArtifactId="browserstack-sdk-archetype-setup" -DarchetypeVersion=1.1 \
-DgroupId=com.browserstack -DartifactId=junit-appium-app-browserstack -Dversion=1.0 \
-DBROWSERSTACK_USERNAME=YOUR_USERNAME -DBROWSERSTACK_ACCESS_KEY=YOUR_ACCESS_KEY -DBROWSERSTACK_PROJECT_REPO=junit-appium-app-browserstack/junit-5:sdk
mvn archetype:generate -B -DarchetypeGroupId="com.browserstack" -DarchetypeArtifactId="browserstack-sdk-archetype-setup" -DarchetypeVersion="1.1" -DgroupId="com.browserstack" -DartifactId="junit-appium-app-browserstack" -Dversion="1.0" -DBROWSERSTACK_USERNAME="YOUR_USERNAME" -DBROWSERSTACK_ACCESS_KEY="YOUR_ACCESS_KEY" -DBROWSERSTACK_PROJECT_REPO="junit-appium-app-browserstack/junit-5:sdk"

Based on your test platform, navigate to the appropriate platform directory.

Copy icon Copy
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 your BrowserStack userName and accessKey.
  3. Set the framework to junit5.
  4. Set the accessibility flag to true. The default value is false.
  5. 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 sample test

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

mvn clean
mvn verify -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

Next steps

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