Skip to main content

SeeTestAutomation - Manually Instrumenting Android Applications

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 .

danger

This process is optional. You should use this process only if, for reasons of security, you wish to retain the signature of the application.

General Background

SeeTestAutomation comes with a unique capability, to automatically control your application internally (Native Object identification) without changing the APK of the application under test. However, because the automatic process uses a public key to resign the application, at times, due to security considerations, it will be inadequate for performing instrumentation and the private key will be needed.

To accommodate such needs, we provide a command line tool that can be used when the application's original APK is built (usually by the build/R&D team).

This tool receives as input the original APK together with its signing information (keystore, storepass, keypass, alias). The tool generates a bundled zip file containing the original, unmodified APK and an additional APK that has been signed with the same keystore file.

Following are the steps you should follow to make your application automation ready:

Process

Step 1: In the root directory of the SeeTestAutomation installation you will find the instrument.exe file.

To run this executable, use the following syntax:

Instrument help

instrument.exe  <sign configuration> -appApk <application APK> -bundleFile <the bundle file>
 
Sign configuration:
-defaultKeystore - will use the default keystore (ignore keystore, storepass, keypass and alias)
or
-keystoreFile <keystore> - the keystore file used to sign the apk
-storepass <storepass> - the password for the keystore
-keypass <keypass> - the password for the used key
-alias <alias> - the alias used in keystore

<appApk> - The path to the target application APK file.
<bundleFile> - The path and directory name of the bundled directory to be generated. Following its generation, be sure to provide your QA team with this included files.


On Mac use './instrument' instead of 'instrument.exe'.

For example: 

Windows: <Installation folder>instrument.exe -keystoreFile C:\Users\user\Desktop\myKey.keystore -storepass 1234 -keypass 4321 -alias aliasKey -appApk C:\Users\user\Desktop\eribank.apk -bundleFile C:\Users\user\Desktop\instrumentedEribank
 
Mac: <Installation folder>./instrument -keystoreFile /Users/user/Downloads/myKey.keystore -storepass 1234 -keypass 4321 -alias aliasKey -appApk /Users/user/Downloads/eribank.apk -bundleFile /Users/user/Documents/instrumentedEribank
 
warning

The bundle directory is created. It should contain two apk files and one properties file.

Step 2: Zip the bundle if needed and Import the zip file to SeeTestAutomation using the Application Manager's Import command.

Special Flags

-camera

Allow testing applications which use the camera feature of a mobile device and enabling using of Simulate Capture command.

For example: 

Windows: <Installation folder>instrument.exe -keystoreFile C:\Users\user\Desktop\myKey.keystore -storepass 1234 -keypass 4321 -alias aliasKey -appApk C:\Users\user\Desktop\eribank.apk -bundleFile C:\Users\user\Desktop\instrumentedEribank -camera
 
Mac: <Installation folder>./instrument -keystoreFile /Users/user/Downloads/myKey.keystore -storepass 1234 -keypass 4321 -alias aliasKey -appApk /Users/user/Downloads/eribank.apk -bundleFile /Users/user/Documents/instrumentedEribank -camera

-camera2

Allow testing applications which use the camera2 api feature of a mobile device and enabling using of Simulate Capture command.

Windows: <Installation folder>instrument.exe -keystoreFile C:\Users\user\Desktop\myKey.keystore -storepass 1234 -keypass 4321 -alias aliasKey -appApk C:\Users\user\Desktop\eribank.apk -bundleFile C:\Users\user\Desktop\instrumentedEribank -camera -camera2
 
Mac: <Installation folder>./instrument -keystoreFile /Users/user/Downloads/myKey.keystore -storepass 1234 -keypass 4321 -alias aliasKey -appApk /Users/user/Downloads/eribank.apk -bundleFile /Users/user/Documents/instrumentedEribank -camera -camera2

-fingerprint

Allow testing applications which use the fingerprint authentication api feature of a mobile device and enabling using of biometric Authentication command.

Windows: <Installation folder>instrument.exe -keystoreFile C:\Users\user\Desktop\myKey.keystore -storepass 1234 -keypass 4321 -alias aliasKey -appApk C:\Users\user\Desktop\eribank.apk -bundleFile C:\Users\user\Desktop\instrumentedEribank -fingerprint
 
Mac: <Installation folder>./instrument -keystoreFile /Users/user/Downloads/myKey.keystore -storepass 1234 -keypass 4321 -alias aliasKey -appApk /Users/user/Downloads/eribank.apk -bundleFile /Users/user/Documents/instrumentedEribank -fingerprint

-disableSecurityMode

For application with security mode, it is necessary to disable the security mode in order to work in non-instrumented mode.

in order to do that, use this instrument tool with a disableSecurityMode flag.

For example: 

Windows: <Installation folder>instrument.exe -defaultKeystore -appApk C:\Users\user\Desktop\eribank.apk -outApk C:\Users\user\Desktop\instrumentedEribank.apk -disableSecurityMode
 
Mac: <Installation folder>./instrument -defaultKeystore -appApk /Users/user/Downloads/eribank.apk -outApk /Users/user/Documents/instrumentedEribank.apk -disableSecurityMode
warning

The outApk file is not instrumented. For instrumentation import this apk to SeeTest (or use this command line tool)