Skip to main content

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 .

warning

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

Continuous Testing comes with the 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 is inadequate for performing instrumentation and the private key is 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.

To make your application ready:

  1. In the root directory of the Cloud installation run instrument.exe (./instrument on a MAC) with this 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.


    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
     

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

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

Special Flags

-camera

This flag enables 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

This flag enables 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

This flag enables 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 an application with security mode, it is necessary to disable the security mode in order to work in non-instrumented mode.

iTo 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).