Automate user authentication
With the Mobile Engine 3.0, you can use the following user authentication mechanisms:
Automate user authentication on local Android emulators
Mobile Engine 3.0 enables you to test fingerprint authentication on local Android emulators.
To do so, you must perform the following actions:
-
Add a fingerprint ID to your Android emulator.
-
Build your TestCase.
Add a fingerprint ID to your Android emulator
For Android user authentication, you have to add fingerprint ID(s) manually to the emulator. To do so, follow the steps below:
-
Run your Android emulator and go to Settings->Security & location->Fingerprint.
-
If you have set up your PIN, enter it on your emulator.
If you haven't set up your PIN, Android emulator will prompt you to add it at this point.
-
Click Add fingerprint.
-
Go to %ANDROID_HOME%\platform-tools.
-
Select File->Open Windows PowerShell to open the command line.
-
In Windows PowerShell, add the line .\adb.exe -e emu finger touch <fingerprintId> where <fingerprintId> corresponds to the value from 1 to 10 that you want to use in your tests. For example: .\adb.exe -e emu finger touch 1
You might need to add this exact line several times, until you see the message Fingerprint added on your emulator.
-
On your emulator, click DONE to finish adding fingerprints.
If you want to add another fingerprint ID, click ADD ANOTHER and repeat step 6.
Build your TestCase
Use the Module Use Android fingerprint authentication to authenticate a user with a fingerprint ID.
The Module is part of the Standard subset. You can find it under Standard modules->TBox XEngines->Mobile.
To authenticate a user on an Android emulator, follow the steps below:
-
Ensure that you have added a fingerprint ID to your Android emulator (see above).
-
Specify the test configuration parameters to establish a connection with the device.
-
Add either the Open Mobile App TestStep or the OpenUrl TestStep as a first TestStep.
-
Drag and drop the Use Android fingerprint authentication Module onto your TestCase.
-
For the FingerprintId ModuleAttribute, enter a value from 1 to 10, depending on the fingerprint ID that you specified.
In this example, you perform the following actions:
Use Android fingerprint authentication Module in a TestCase |
Automate user authentication on iOS simulators
On iOS devices, you can use face or fingerprint recognition to authenticate a user. Mobile Engine 3.0 enables you to test these authentication methods on iOS simulators.
Use the Modules Set iOS biometrics enrollment and Use iOS biometric authentication to specify parameters for FaceID or TouchID authentication on iOS simulators.
These Modules are part of the Standard subset. You can find them under Standard modules->TBox XEngines->Mobile.
To authenticate a user on an iOS simulator, follow the steps below:
-
Specify the test configuration parameters to establish a connection with the device.
-
Add either the Open Mobile App TestStep or the OpenUrl TestStep as a first TestStep in the execution.
-
Drag and drop the Set iOS biometrics enrollment Module onto your TestCase.
-
For the State ModuleAttribute, enter True.
-
As the next TestStep, add the Use iOS biometric authentication Module.
-
For the Type of biometric authentication ModuleAttribute, select the type of authentication from the drop-down:
-
To use face recognition, select FaceID.
-
To use fingerprint recognition, select TouchID.
-
-
For the Positive authentication ModuleAttribute, enter True if you want to trigger positive authentication or False if you want to trigger negative authentication.
In this example, you perform the following actions:
Set iOS biometrics enrollment Module and Use iOS biometric authentication Module in a TestCase |
Automate user authentication on Perfecto cloud devices
You can use face or fingerprint recognition to authenticate a user on Android and iOS cloud devices on Perfecto.
Use the Module Use Perfecto biometrics authentication to specify parameters for user authentication on Perfecto cloud devices.
This Module is part of the Standard subset. You can find it under Standard modules->TBox XEngines->Mobile.
To authenticate a user on a Perfecto cloud device, follow the steps below:
-
Specify the test configuration parameters to establish a connection with the device.
-
Add the Open Mobile App TestStep.
-
Add TestSteps that navigate to the place in you application where you want to trigger user authentication.
-
Drag and drop the Use Perfecto biometrics authentication Module onto your TestCase.
-
For the Application ID ModuleAttribute, enter the ID of an application that you opened with the Open Mobile App TestStep. For Android applications, enter the PackageName. For iOS applications, enter the BundleID.
-
For the Authentication positive ModuleAttribute, enter the value True if you want to trigger positive authentication or False if you want to trigger negative, that is, failed, authentication.
-
Optionally, for the Error type ModuleAttribute, select the type of error that you want to trigger by negative authentication.
The table below lists the possible types of errors that you can trigger.
Type of error |
Description |
---|---|
authFailed |
This error occurs when the authentication is failed. Example: You provide a different fingerprint than the one that is configured. |
userFallback |
This error occurs when the authentication method you use is not available. Example: You try to authenticate yourself via a fingerprint, but the available method on your device is only password authentication. |
userCancel |
This error occurs when you cancel the authentication. |
systemCancel |
This error occurs when the system cancels the authentication. |
lockout |
This error occurs when the authentication is failed multiple times and the system locks your user account. |
In this example, you perform the following actions:
Use Perfecto biometrics authentication Module in a TestCase |