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 testing to run accessibility checks on your 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
- Ensure you have a BrowserStack Username and Access Key. Obtain your 
usernameandaccess keyfrom the Account & Profile section on the dashboard.
If you have not yet created an account, sign up for a free trial. - Ensure you have a functional Serenity test suite. To set one up, see Run accessibility checks on a sample repo.
 - Ensure you have the following installed and configured in your system’s 
PATH: 
Integrate App Accessibility Automate to run accessibility checks
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 configuration 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.
The minimum supported BrowserStack SDK version is 1.32.3.
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.
- Navigate to root directory.
    
cd Android - Add 
serenity-browserstackas Maven dependency in yourpom.xmlfile and save the file.<dependency> <groupId>net.serenity-bdd</groupId> <artifactId>serenity-browserstack</artifactId> <version>3.3.4</version> </dependency> 
- Navigate to root directory.
    
cd ios - Add 
serenity-browserstackas Maven dependency in yourpom.xmlfile 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).
- Navigate to the 
resourcesdirectory of your preferred platform:cd android/src/test/resources - Add your credentials to the 
serenity.conffile:webdriver { driver = remote remote.url = "https://hub.browserstack.com/wd/hub" remote.driver = "appium" } browserstack.user="YOUR_USERNAME" browserstack.key="YOUR_ACCESS_KEY" 
- Navigate to the 
resourcesdirectory of your preferred platform:cd ios/src/test/resources - Add your credentials to the 
serenity.conffile:webdriver { driver = remote remote.url = "https://hub.browserstack.com/wd/hub" remote.driver = "appium" } browserstack.user="YOUR_USERNAME" browserstack.key="YOUR_ACCESS_KEY" 
Modify the 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.
- Open the 
browserstack.ymlfile. - Add your 
userNameandaccessKey. - Add the 
projectNameandbuildName. - Set the 
frameworktoserenity. - Set the 
accessibilityflag totrue. By default, the flag is set tofalse. - Configure the 
accessibilityOptionsproperty to set various accessibility testing options. For details, see Configuration options. - Add the relative or absolute path of the app you want to test in the 
appproperty. For example,app: ./examples/BStackSampleApp.apk. You can upload an Android app (.apkor.aabfile) or an iOS app (.ipafile) from your local filesystem. - Specify all the device, OS, and OS version combinations that you want to test in the 
platformssection. 
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.
View the Accessibility test report
After the test completes, access the report in your project folder on the 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
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!