Run script-based instrumentation on Android apps
To run script-based instrumentation on Android apps, perform the following steps.
For supported environments, prerequisites, and limitations, see Script-based instrumentation for Android apps.
For examples, see Examples for Android script instrumentation.
If you run into any problems during the instrumentation process, see Troubleshooting script instrumentation for Android.
On this page:
Step 1 | Obtain the Python script
The script to activate the instrumentation is called customInstrumentWrapperAndroid.py
. You can retrieve the script from our Perfecto Code site.
Install the script on the workstation that will be used to perform the instrumentation, in a folder of your choice.
Step 3 | (Optional) Gather certificate information
If you want the instrumented app to be signed with your own certificate, make sure you have the following information ready:
-
Certificate file
-
Certificate key
-
Certificate user
-
Keystore password
These values are used to sign the app during instrumentation. If you don’t provide them, the app will be signed with a default debug certificate instead.
You may need to contact your DevOps or mobile development team to obtain this information if you don’t already have access to it.
Step 4 | Generate a security token
You need a Perfecto security token to authenticate the instrumentation script.
To generate the token:
-
In the Perfecto UI, go to My profile > My security token.
-
Click GENERATE SECURITY TOKEN.
-
To copy the token for use in your script, click Copy to clipboard.
Alternatively, you can generate a security token using Perfecto's public API.
Step 5 | Run the instrumentation script
-
Place the following items on the local workstation:
-
The applicaton file (mandatory)
-
The Python script (mandatory)
-
The token file (mandatory)
-
The certificate file (optional)
-
-
Using the command line interface, run the
customInstrumentWrapperAndroid.py
script from the folder where it was installed, supplying the relevant parameters. To learn more about the available parameters, see Parameters for Android script instrumentation. For examples, see Examples for Android script instrumentation.Important: The path of the shell must be the path of the script.For Linux, use either the
python
or thepython3
command, whichever activates Python 3.
When the instrumentation completes, a notification appears and the instrumented application file is copied to the target folder, indicated by the output folder
parameter (see examples).
At every run, the application hash must be replaced. Otherwise, AWS uses the old application file and does not store a new one.
Step 6 | Upload the app to Perfecto
How you upload the instrumented application to Perfecto depends on whether you are a manual tester or an automation tester.
Make sure not to instrument the app again during the app installation process.
-
Manual tester: Install and start the app through the Perfecto UI.
To learn more, see Application management.
-
Automation tester: Upload the app to the Perfecto repository, and then install and start the app on the device using Appium drivers.
To learn more, see Application installation and startup with Appium and Application installation and startup with Appium.
What's next?
When the app is instrumented, installed, and running on the device, you can inject sensory input. To learn more, see:
-
Inject biometric data (manual testing)
-
Injection of sensory input (automation testing)