Skip to main content
No Result Found

Integrate Serenity 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 Serenity. You can integrate your existing functional test suites with App Accessibility Automate to run accessibility checks on your mobile apps. You can access the generated accessibility violation reports on the App Accessibility dashboard.

For Android devices, App Accessibility automated tests are supported on version 11 and above.

Prerequisites

Integrate App Accessibility Automate to run accessibility checks

Integrate BrowserStack automate with your test-suite based on the preferred method you use to build your project.

Set your BrowserStack credentials

Save your BrowserStack credentials as environment variables to simplify running your test suite from your local or CI environment.

Set the following values in either your Zsh (~/.zprofile) or Bash (~/.profile) shell conifguration file.

export BROWSERSTACK_USERNAME=YOUR_USERNAME
export BROWSERSTACK_ACCESS_KEY=YOUR_ACCESS_KEY

In your terminal or command-line prompt, enter the following command:

setx BROWSERSTACK_USERNAME "YOUR_USERNAME"
setx BROWSERSTACK_ACCESS_KEY "YOUR_ACCESS_KEY"
set BROWSERSTACK_USERNAME=YOUR_USERNAME
set BROWSERSTACK_ACCESS_KEY=YOUR_ACCESS_KEY

Install BrowserStack SDK using Maven archetype

Run the following command in your terminal or command-line to add the browserstack-java-sdk dependency and browserstack.yml file to your project.

mvn archetype:generate -B -DarchetypeGroupId=com.browserstack \
-DarchetypeArtifactId=browserstack-sdk-archetype-integrate -DarchetypeVersion=1.0 \
-DgroupId=com.browserstack -DartifactId=browserstack-sdk-archetype-integrate 
-Dversion=1.0 \
-DBROWSERSTACK_USERNAME=YOUR_USERNAME -DBROWSERSTACK_ACCESS_KEY=YOUR_ACCESS_KEY 
-DBROWSERSTACK_FRAMEWORK=serenity
mvn archetype:generate -B -DarchetypeGroupId="com.browserstack" -DarchetypeArtifactId="browserstack-sdk-archetype-integrate" -DarchetypeVersion="1.0" -DgroupId="com.browserstack" -DartifactId="browserstack-sdk-archetype-integrate" -Dversion="1.0" -DBROWSERSTACK_USERNAME=""YOUR_USERNAME"" -DBROWSERSTACK_ACCESS_KEY="YOUR_ACCESS_KEY" -DBROWSERSTACK_FRAMEWORK="serenity"

Add serenity-browserstack dependency in pom.xml

Add the Serenity BrowserStack plugin to your project dependencies.

  1. Navigate to root directory.
     cd Android
    
  2. Add serenity-browserstack as Maven dependency in your pom.xml file and save the file.
     <dependency>
       <groupId>net.serenity-bdd</groupId>
       <artifactId>serenity-browserstack</artifactId>
       <version>3.3.4</version>
     </dependency>
    
  1. Navigate to root directory.
     cd ios
    
  2. Add serenity-browserstack as Maven dependency in your pom.xml file and save the file.
     <dependency>
       <groupId>net.serenity-bdd</groupId>
       <artifactId>serenity-browserstack</artifactId>
       <version>3.3.4</version>
     </dependency>
    

Update the serenity configuration file

The BrowserStack sample project uses the Serenity BrowserStack plugin. Therefore, you must set your BrowserStack credentials in the serenity.conf file in the src/test/resources directory of your test platform (Android or iOS).

  1. Navigate to the resources directory of your preferred platform:
     cd android/src/test/resources
    
  2. Add your credentials to the serenity.conf file:
     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 resources directory of your preferred platform:
     cd ios/src/test/resources
    
  2. Add your credentials to the serenity.conf file:
     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 root directory

Based on your test platform, navigate back to the Android or iOS directory in the serenity-appium-app-browserstack parent directory.

Copy icon Copy
Copy icon Copy

Modify the BrowserStack configuration file

The browserstack.yml file defines the capabilities needed to run your tests on BrowserStack. It is located in your project’s root directory and is included in the downloaded sample.

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

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

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