How to Achieve Advanced BDD Test Automation With Perfecto & Quantum
Using a BDD framework for testing is a great way to expand automation to non-technical testers. With tests that anyone can understand, automate, and troubleshoot, teams can leverage BDD test automation to improve speed and quality at scale.
With Quantum, Perfecto's BDD testing framework, non-technical testers can even automate complex scenarios like image injection and accessibility testing.
This blog post will give an overview of accessibility testing for Android, iOS, and web applications using Quantum’s built-in features, as well as how to use Perfecto’s image injection using the Quantum framework.
Advanced BDD: Accessibility Testing
These days, apps must strive to be accessible for everyone, including vision, hearing, or otherwise impaired users.
To help you make your applications more accessible, Perfecto offers integrations with mobile platform accessibility tools Accessibility Inspector (iOS) and Accessibility Scanner (Android). With these tools, teams can check the current screens of applications for accessibility issues.
Accessibility Testing for Mobile
To show you how accessibility testing works for mobile devices, we will use a sample Expense Tracker application for Android and iOS.
Using a Gherkin language powered by Quantum, we will automate the following scenario:
BDD testing with Quantum is already a simple process. Writing BDD tests in plain English makes it easy for anyone testing the application to understand what is happening. Stakeholders can also get fast and easy-to-understand feedback about how the application is behaving.
Another advantage of BDD testing with Quantum is that these automated tests are executed in the Perfecto cloud. Testing in the Perfecto cloud keeps executions stable on clean and secured Android/iOS devices and desktop browsers.
To test for accessibility in our scenario, teams can start by uploading an application file to the Perfecto repository to show which screen to test on the app for accessibility issues. In this case, the application file will be for the login page of the Expense Tracker.
Once the application file is uploaded and you are ready to run the native app accessibility sample, you only need to add the following Gherkin step to a regular BDD test:“I perform an audit of the accessibility on tag application screen ‘Login Screen.’”
In the Perfecto dashboard, you can check and confirm the Live Stream of the execution on both your Android and iOS devices.
Perfecto Reporting for Accessibility Testing
Once the execution finishes, you can see in your Perfecto Report whether the login test passed without any accessibility issues. The following screenshot shows that the accessibility test passed successfully.
In the Perfecto Reports, the download section will show the accessibility reports of each screen that was audited.
Accessibility Testing for Web
Now that we have looked at accessibility testing for native mobile applications, it will be easier to understand how to do accessibility testing for the web apps using Quantum.
The Quantum framework includes support for web accessibility testing by using AXE, an open-source solution. Since Quantum already has this support in the back end, there is no need to configure anything else to run your accessibility tests. You can just use the same steps as you would for mobile.
In this example, I will run an accessibility test for the tag application screen, “Login Screen.”
Once the execution finishes, you can open the Perfecto reports from the URL in the console. While the web accessibility report will look very similar to the mobile one, it will also include Perfecto Assertion Checkpoint flags. These flags refer to the failed accessibility validations that Axe found during the test run.
Advanced BDD: Mobile Image Injection
In addition to accessibility testing, Perfecto also allows non-technical testers to inject images into automated tests to mimic camera behavior in a mobile application.
Mobile application capabilities that require camera use are continuing to increase, from barcode readers to bank check scanners. Image injection helps add cases that test these functions into your automated testing suite.
Image injection takes an image (in either .jpeg, .jpg, .png, or .bmp format) that is stored in the Perfecto repository and presents it to the application as if it was read by the device camera. This allows you to test different ways that application engages with the camera, such as different types of focus and image placement.
Like other advanced mobile testing functions, such as biometric authentication, image injection requires that you install the application with sensor instrumentation.
Example Automated Test With Image Injection
To run an automated test that include image injection with Perfecto, set up your project the way you would if you were to run an accessibility test. Yet instead of adding an application file from the Perfecto Repository, you will need to add a target image from the repository that you will like to inject into the application in order to test.
Quantum then offers built-in steps that allow you to start and stop the image injection. This makes the complex issue of testing how an image is injected into an application easy to automate and simple to execute.
The following video will show how quickly you can inject images as part of your Quantum BDD tests:
Both accessibility testing and image injection within mobile testing are important parts of a comprehensive testing strategy. With just a few simple steps, Perfecto’s Quantum framework makes it easy to do both.
Watch Mobile Testing in Action
See a demo of accessibility testing, image injection, as well as other advanced mobile testing capabilities that you would like to explore with Perfecto and Quantum.