Skip to main content
Experience faster, smarter testing with BrowserStack AI Agents. See what your workflow’s been missing. Explore now!
No Result Found
Connect & Get help from fellow developers on our Discord community. Ask the CommunityAsk the Community

Run accessibility checks on a Serenity sample repo

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

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

Prerequisites

Run a sample build

Get the sample project

Get the BrowserStack sample Serenity project using one of the following options:

Option 1: Download repository

Download the sample Serenity repository to your system.

Option 2: Clone repository

Clone the sample Git repository using the following commands:

git clone  https://github.com/browserstack/serenity-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=serenity-browserstack -Dversion=1.0 \
-DBROWSERSTACK_USERNAME=YOUR_USERNAME -DBROWSERSTACK_ACCESS_KEY=YOUR_ACCESS_KEY -DBROWSERSTACK_PROJECT_REPO=serenity-browserstack 
mvn archetype:generate -B -DarchetypeGroupId="com.browserstack" -DarchetypeArtifactId="browserstack-sdk-archetype-setup" -DarchetypeVersion="1.1" -DgroupId="com.browserstack" -DartifactId="serenity-browserstack" -Dversion="1.0" -DBROWSERSTACK_USERNAME="YOUR_USERNAME" -DBROWSERSTACK_ACCESS_KEY="YOUR_ACCESS_KEY" -DBROWSERSTACK_PROJECT_REPO="serenity-browserstack"
mvn archetype:generate -B -DarchetypeGroupId="com.browserstack" -DarchetypeArtifactId="browserstack-sdk-archetype-setup" -DarchetypeVersion="1.1" -DgroupId="com.browserstack" -DartifactId="serenity-browserstack" -Dversion="1.0" -DBROWSERSTACK_USERNAME="YOUR_USERNAME" -DBROWSERSTACK_ACCESS_KEY="YOUR_ACCESS_KEY" -DBROWSERSTACK_PROJECT_REPO="serenity-browserstack"

Update the serenity configuration file

Skip this step if you downloaded the sample project using Maven Archetype in step 1.

Add your BrowserStack credentials to the serenity.conf file to use the Serenity BrowserStack plugin to run the sample build.
If your credentials are not already set as environment variables, manually add them to the serenity.conf file of your test platform (Android or iOS).

  1. Navigate to the directory that contains the configuration file:
     cd serenity-appium-app-browserstack/android/src/test/resources
    
  2. Open the serenity.conf file and add your BrowserStack credentials:
     webdriver {
         driver = remote
         remote.url = "https://hub.browserstack.com/wd/hub"
         remote.driver = "appium"
     }
    
     browserstack.user="YOUR_USERNAME"
     browserstack.key="YOUR_ACCESS_KEY"
    
  1. Navigate to the directory that contains the configuration file:
     cd serenity-appium-app-browserstack/ios/src/test/resources
    
  2. Open the serenity.conf file and add your BrowserStack credentials:
     webdriver {
         driver = remote
         remote.url = "https://hub.browserstack.com/wd/hub"
         remote.driver = "appium"
     }
    
     browserstack.user="YOUR_USERNAME"
     browserstack.key="YOUR_ACCESS_KEY"
    

Go to the platform directory

Based on your test platform, navigate back to the platform’s root directory.

  1. Navigate back to the android directory:
    cd ../../..
    
  2. Ensure you are in the ../serenity-appium-app-browserstack/android directory:
    • For macOS/Linux/PowerShell:
      pwd
      
    • For Windows Command Prompt:
      cd
      
  1. Navigate back to the ios directory:
    cd ../../..
    
  2. Ensure you are in the ../serenity-appium-app-browserstack/ios directory:
    • For macOS/Linux/PowerShell:
      pwd
      
    • For Windows Command Prompt:
      cd
      

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. Add your BrowserStack userName and accessKey.
  3. Set the framework to serenity.
  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:

Run an Android test
Copy icon Copy
Run an iOS test
Copy icon Copy

View the accessibility test report

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