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:

  1. Run your Android emulator and go to Settings->Security & location->Fingerprint.

  2. 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.

  3. Click Add fingerprint.

  4. Go to %ANDROID_HOME%\platform-tools.

  5. Select File->Open Windows PowerShell to open the command line.

  6. 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.

  7. 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:

  1. Ensure that you have added a fingerprint ID to your Android emulator (see above).

  2. Specify the test configuration parameters to establish a connection with the device.

  3. Add either the Open Mobile App TestStep or the OpenUrl TestStep as a first TestStep.

  4. Drag and drop the Use Android fingerprint authentication Module onto your TestCase.

  5. 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:

  • You open the mobile application with the Module Open Mobile App.

  • In the Click the Login button TestStep, you click a button that requires user authentication.

  • In the TestStep Use Android fingerprint authentication, you specify the fingerprint ID. If you have set the same ID on your emulator, the authentication is positive. Consequently, the TestStep passes.

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:

  1. Specify the test configuration parameters to establish a connection with the device.

  2. Add either the Open Mobile App TestStep or the OpenUrl TestStep as a first TestStep in the execution.

  3. Drag and drop the Set iOS biometrics enrollment Module onto your TestCase.

  4. For the State ModuleAttribute, enter True.

  5. As the next TestStep, add the Use iOS biometric authentication Module.

  6. 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.

  7. 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:

  • You open the mobile application with the Module Open Mobile App.

  • You enable biometric authentication on your iOS simulator. In the TestStep Set iOS biometrics enrollment, you set the ModuleAttribute State to True.

  • In the Click the Login button TestStep, you click a button which triggers an action that requires user authentication.

  • In the TestStep Use iOS biometric authentication, you set the type of user authentication to TouchID.

  • To trigger positive authentication, you set the TestStepValue Positive authentication to True.

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:

  1. Specify the test configuration parameters to establish a connection with the device.

  2. Add the Open Mobile App TestStep.

  3. Add TestSteps that navigate to the place in you application where you want to trigger user authentication.

  4. Drag and drop the Use Perfecto biometrics authentication Module onto your TestCase.

  5. 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.

  6. 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.

  7. 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:

  • You open the mobile application with the Module Open Mobile App.

  • In the Use Perfecto biometrics authentication TestStep, you set the ModuleAtrribute Authentication positive to False, because you want to trigger failed authentication. You select userFallback in the Error type ModuleAttribute, because you want to trigger an error caused by using an authentication method that is not configured on the device.

Use Perfecto biometrics authentication Module in a TestCase