Skip to main content

iOS

info

Please note that this tool is classified as a Legacy tool. We recommend transitioning to our updated solutions to maintain optimal performance and security in your workflows. For more information on this matter, please reach out to technical support .

Set the reply of the authentication attempt by using the SetAuthenticationReply command.
For example, select the error AuthenticationFailedError to simulate the result of three bad authentication attempts (or more depending on the app definitions).

Here, we set the delay to 0 to prevent any delay before the response (after the request).

In case the application requests authentication upon launch, set in advanced the desired reply as a launch environment using Launch With Options.

For example, if com.company.MyApp presents the on-screen authentication pop-up as soon as it launches, and we want to respond with a successful authentication, we would write the following in our test:

@Test
public void launchAndAuthenticate() {
// Create Map for the Authentication configuration Environments
Map<String, String> env = new HashMap<>();


// "0" - Default behavior (no mocking involved).
// "1" - Mock successful authentication
// "2" - Show All option in the application UI (can be used for test development).
// "-1" - "-9" Mock authentication errors (See link below for more details).
String authValue = "1";
env.put("EXPERI_MOCK_AUTH_HANDLE_CODE", authValue);

// Wait 1000 milliseconds before responding to application's authentication request:
env.put("EXPERI_MOCK_AUTH_HANDLE_DELAY_MILLIS", "1000");


// Create Map object for the launch command
Map<String, Object> launchOptions = new HashMap<>();
launchOptions.put("launch_env", env);

// Equivalent to stopIfRunning = true, to force fresh instance of the application (otherwise the environment might be ignored).
launchOptions.put("relaunch", true);


// Send the launch command to the device
client.launch("com.company.MyApp", launchOptions);
}

The list of supported error replies, along with their meaning, can be found in Apple's documentation: https://developer.apple.com/reference/localauthentication/laerror.code