Instrumentation

Instrumentation is a process that prepares an application for testing or automation. Part of the instrumentation process may add "instruments" that allow the testing framework to gain access to parts of the application. Instrumentation only affects the application code. It does not affect mobile OS performance or activity.

Perfecto provides tools for instrumenting mobile applications for different purposes. Instrumentation options are part of the app installation process.

Tip: For a visual explanation of the instrumentation process, see Instrumentation illustrated.

There are three distinct instrumentation options:

  • Cloud-based instrumentation: The user application is instrumented via the Perfecto UI during app installation or through automation capabilities. This option does provides no control and does not support signing with your own certificate. To learn more, see Cloud-based instrumentation.

  • Offline instrumentation: The user application is instrumented entirely on the local machine, without requiring a network connection. This option is based on a ZIP file obtained from Perfecto Support. It does not require any online services or cache and provides the most control over the process. At the end, you need to install the app on the device. To learn more, see Offline instrumentation for iOS apps and Offline instrumentation for Android apps.

  • Script instrumentation: The user application is instrumented using a Python script that runs on the local machine. A network connection is required to send requests and retrieve the instrumented application. At the end, you need to install the app on the device. This option allows more control and supports signing with your own certificate.

    To learn more, see Script-based instrumentation for iOS apps and Script-based instrumentation for Android apps.

Limitations

The following limitations for Perfecto instrumentation of mobile applications are known:

Instrumentation of hybrid applications

Hybrid applications, applications that display parts of the UI in WebView objects, require basic instrumentation to provide access to the parts of the UI hosted in the WebView objects.

Hybrid application instrumentation notes

  • Instrumentation is required to gain access to DOM objects in Hybrid apps.
  • As a general rule, on-the-fly instrumentation is preferred over framework instrumentation.
  • In addition to SingleDex and Objective-C apps, Perfecto also supports instrumentation for MultiDex apps (Android) and Swift apps (iOS).

Sensor instrumentation

Perfecto supports interaction with the different input sensors of mobile devices in Perfecto to inject different data to allow smooth, reproducible testing of applications. For example, the image inject functionality allows the tester to provide an image file to the device camera. Before using the sensor functionality, the application needs to be instrumented to provide an indication to Perfecto when the sensor prompts the user for data.

Sensor instrumentation is performed when the app is installed a part of:

The following types of sensor instrumentation are available:

  • Camera instrumentation

    To simulate image input from the device camera, you can use Perfecto's image injection feature. The application must be prepared for image injection during the installation process using sensor instrumentation.

  • Authentication instrumentation

    To simulate authorization analysis using the device fingerprint reader or face recognition system, you can use Perfecto 's sensor authentication simulation feature. The use of this feature requires that the application accessing the authentication sensor be instrumented (with sensor instrumentation) to let the test/automation script identify the activation of the sensor.

Biometric authentication on iOS devices

After installing and instrumenting an iOS application that uses biometric authentication, the first time the authentication method is called during app use, a message such as the following appears (where "FinterprintTest" is the name of the application and Face ID is the authentication method):

Make sure to allow the authentication method, either by pressing OK or, for automated testing, by implementing the correct selection in your scripts. Otherwise, the application will not be able to use biometric authentication methods and report related errors.

Secured screen instrumentation

On devices running Android 12 or later, secured screens are currently subject to a limitation that is linked to FLAG_SECURE, a flag that was originally declared for better security and preventing screenshots, but that now prevents screen captures and screen video recording on devices running Android 12 or later, causing the screen to appear black and affecting the testing process.

Select this option on devices running Android 12 or later if your app includes secured screens.

With this option turned on, calls on the app that use FLAG_SECURE will be removed (only setFlags() and addFlags() methods that use FLAG_SECURE are affected), and secured screens will be visible in the installed app.

Re-signing of the application

For more information, see Re-sign an application.

For a visual explanation of the re-signing processes, see Re-signing illustrated.

In this section