How to Test Biometric Authentication With Perfecto & Appium
Biometric authentication is becoming increasingly essential to providing a high-quality mobile application user experience.
By allowing customers to sign into their apps or authenticate their transactions by validating with their biometric data, leading banks and other enterprises are providing mobile experiences that are both convenient and secure.
In post-Covid times, it has become even more critical for apps to support multiple forms of biometric authentication. In fact, rumor has it that Apple will be bringing back Touch ID in an on-screen fingerprint scanner (like those on Samsung’s and other Android devices) in addition to Face ID to provide mask-wearing users an alternative way to validate their biometric data.
It should therefore be no surprise that biometric validation will become increasingly important to mobile application testing as well. Enterprises should expect an increase in scenarios that will involve not just one, but two forms of biometric validation. Teams will need to test these biometric validations at scale, both manually and in automation, to achieve a high level of CI/CD.
With Perfecto, testing fingerprints and other types of biometric authentication is possible with Appium, as well as our own advanced capabilities that allow for biometric authentication on both real and virtual devices.
This blog post will give a detailed overview of Perfecto biometric authentication testing with Appium.
Why Use Perfecto to Test Biometric Authentication
Open-source Appium has been supporting biometric authentication for a while now, so this is not a new concept in the mobile testing space. Yet Appium only supports biometric authentication on virtual devices, such as iOS simulators and Android emulators.
For true end-to-end test coverage, it is essential to test real journeys on real mobile devices. Therefore, you need to be able to validate biometrics on real devices as well to provide a high-quality mobile user experience.
While Perfecto integrates seamlessly with Appium, Perfecto has also built on top of open-source technologies to provide advanced capabilities so you can “test like your users.” These capabilities include:
- Biometric validation
- Image injection
- Network virtualization
- Location and audio injection
- Visual analysis
Perfecto offers the unique capability to test both successful and failed validation of Face ID, Touch ID and fingerprint on real iOS and Android devices. These advanced biometric authentication capabilities are particularly important to many of our customers, including over 80% of the top 40 global banks and Tier-1 players in telecommunications and retail who have implemented biometrics in their app journeys.
With Perfecto, you can easily run tests in parallel and scale across multiple platforms.
Automating Tests That Include Biometric Authentication With Perfecto
Most IDEs let you develop Appium tests in the same way. This example will use IntelliJ and Quantum, which is an open-source BDD framework that already has built-in Perfecto capabilities, including biometric authentication.
This article also shares more information about how to use Appium and Quantum for Android testing.
Quantum already provides biometric validation step definitions. Therefore, you simply add a step to validate a successful (or failed) Face ID, Touch ID, or fingerprint validation in your test scenario as part of the feature file. The following example shows how to do this with the auto-intelligent code completion for Cucumber in IntelliJ:
Adding this step is all you need to do to authenticate biometrics on either iOS or Android. The test will automatically know whether to validate Face ID, Touch ID,, or fingerprint depending on which device you are using to execute your test.
You can also validate biometric data easily during manual test sessions using the widget for Face ID (which will work with all forms of biometric validation on both iOS and Android):
The Need for Instrumentation
To override the application’s biometric sensor API and allow Perfecto to inject the successful or failed biometric authentication, users must first prepare their application with “instrumentation.”
Instrumentation is a process to get the application ready for testing or automation by adding "instruments" that allow the testing framework to gain access to parts of the application.
In the case of biometric authentication, users will want to instrument for the sensors (both the biometric sensor and the camera for image injection). This instrumentation will enable Perfecto to override these sensors and allow access to the web view for hybrid applications.
The following image shows how you can instrument your application on the fly during a manual test session.
You can also instrument your application or by automation by using a set of capabilities. Here is an example set you can use in TestNG:
<parameter name="driver.capabilities.app" value="PUBLIC:ExpenseTracker/InvoiceApp1.0.ipa"/> <parameter name="driver.capabilities.bundleId" value="io.perfecto.expense.tracker"/> <parameter name="driver.capabilities.sensorInstrument" value="true"/>
Testing biometric authentication with Perfecto is both simple and highly beneficial to enterprises looking to up their mobile application quality.
Key benefits of using Perfecto for testing biometrics include:
- A seamless integration with Appium for iOS and Android.
- Simple automated testing using Quantum with full capabilities built-in for biometric validation amongst other things.
- Parallel executions of end-to-end tests that are simple and scalable.
- The unique ability to test full user journeys, without being blocked by biometric validation or need to provide actual biometric data.
Watch Biometric Authentication in Action
See a custom demo of testing biometric validation with Perfecto and Appium.