Integrate Cucumber - Ruby test suite with App Accessibility testing
Run Cucumber tests using Ruby as a test runner to perform accessibility checks on your app.
BrowserStack App Automate supports running Cucumber tests in Ruby on a wide range of real Android and iOS devices. You can integrate your existing Cucumber + Ruby test suites with BrowserStack to run accessibility checks on your mobile apps using real devices.
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
userNameandaccessKeyfrom the Account & Profile section on the dashboard.
If you have not yet created an account, sign up for a free trial. - Ensure you have Ruby
3.2.0or later installed on your system. To download Ruby, see ruby-lang.org. - Ensure you have
Bundlerinstalled on your system. To installBundler, follow the steps outlined in the Bundler installation guide. - Access to an Android app (
.apk,.aab, or.xapkfile) or an iOS app (.ipafile). - An existing Cucumber - Ruby test suite for your mobile app.
Integrate your Cucumber - Ruby test suite with App Accessibility testing
Upload your app
Upload your Android app (.apk, .aab, or .xapk file) or iOS app (.ipa file) to BrowserStack servers using REST API.
The following sample cURL command demonstrates how to upload an app:
curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X POST "https://api-cloud.browserstack.com/app-automate/upload" \
-F "file=@/path/to/app/file/Application-debug.apk"
A sample response for the request is shown below:
{
"app_url": "bs://c8ddcb5649a8800075bfd8f151115bba6b3",
"custom_id": "SampleApp",
"shareable_id": "tests/SampleApp"
}
Note the app_url value returned in the API response. You will use this value to set the app capability in your test configuration file.
Add the BrowserStack Ruby SDK dependency
- Navigate to the Gemfile in your Cucumber - Ruby test suite and add the BrowserStack Ruby SDK dependency:
gem 'browserstack-ruby-sdk' - Install the BrowserStack Ruby SDK and other gems from your Gemfile:
bundle install
Create the browserstack.yml configuration file
Use the BrowserStack Capability Generator to create a browserstack.yml file and save it in the same directory as your Gemfile.
The browserstack.yml configuration file defines the required capabilities to run tests on BrowserStack. If you are testing on both Android and iOS devices, you must create separate configuration files for each platform.
Modify the configuration file
Modify the browserstack.yml file to include the accessibility testing capabilities.
- Open the
browserstack.ymlfile. - Set your BrowserStack
usernameandaccess_key. - Update the
appvalue with theapp_urlfrom step 1. - Add the
accessibilityflag and set its value totrue. - Configure the
accessibilityOptionsproperty to set various accessibility testing options. For details, see Configuration options. - Save the file.
To auto-generate screen reader testing reports for your app’s workflow, set the screenReaderAutomationReport flag to true under accessibilityOptions.
The project and name 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.
Run the sample test
From the directory containing your features/ folder, run:
browserstack-sdk exec cucumber features/<feature-file>.feature
The SDK will automatically use the browserstack.yml file in your current working directory.
To use a different config file, specify it with --browserstackConfigFile:
browserstack-sdk exec --browserstackConfigFile=<path/to/config/file.yml>
View the accessibility test report
After the test completes, view 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!