Page tree
Skip to end of metadata
Go to start of metadata

Install(app, Instrumented, KeepData)

or

Install(app, Instrumented, KeepData, CustomKeyStorePath, CustomKeyStorePassword, CustomKeyAlias, CustomKeyPassword)

Description

Install the application on the tested device during runtime.

The second form is available for instrumented apps on Android devices and will use a custom keystore to sign the application.

Note: Throws an exception if installation is not successful.
Note: Version downgrade is allowed on debuggable packages only

Parameters

  • SeeTestAutomation - Application: Application name.
    • Application identifier which is available on the application manager
    • Path to the application on local disk
    • Install from URL (supported protocols HTTP/HTTPS (Default Ports: 80/443))

    • Install from the cloud with unique application name

      HTTPS

      To install an application from HTTPS: add the line "trust.ignore=true" to the app.properties file located in the %appdata% folder.

  • instrument: Boolean (relevant only for installation not by the Application identifier).
    • true: will be installed  instrumented
    • false: will be installed regularly without instrumentation
  • KeepData - (Only for android)
    • true: will upgrade the existing application installed without losing its data.
    • false: will run over the application
  • CustomKeyStorePath - (only for Android when instrumenting)
    • Location of the custom keystore to be used for signing
  • CustomKeyStorePassword - (only for Android when instrumenting)
    • Password for the custom keystore
  • CustomKeyAlias - (only for Android when instrumenting)
    • Key alias in the custom keystore
  • CustomKeyPassword - (only for Android when instrumenting)
    • Key password in the custom keystore

Installation Options

Install from application manager

Scenario: In the following example we will use the application identifier as available on the application manager (No need to specify a version number)

 

Supported in iOS Supported in Android

Parameters:

  • Path: Application path – set to com.imdb.mobile/.Home
  • instrument: Not relevant - Will always be installed instrumented
  • KeepData: Will be set to True

Code Examples

Java Example
client.install("com.imdb.mobile/.Home", true, true);
C# Example
client.Install("com.imdb.mobile/.Home", true, true);
VBScript Example
client.Install("com.imdb.mobile/.Home", true, true);
Python Example
self.client.install2("com.imdb.mobile/.Home", True, True);
Perl Example
$client->install2("com.imdb.mobile/.Home", 1, 1);
RFT Example
client.install("com.imdb.mobile/.Home", true, true);
VUGen Example
ic_install(&c, "com.imdb.mobile/.Home", IC_TRUE, IC_TRUE);

Install from local disk

Scenario: In the following example we will use the 'Install' command with a path to IMDb apk available on the local disk. We will set the instrument parameter to true in order to instrument the app during installation.

Supported in iOS Supported in Android

Parameters:

  • Path: Application path – set to C:\applications\com.imdb.mobile.apk
  • Instrument: Will be set to True
  • Keep Data: Will be set to True

Code Examples

Java Example
client.Install("c:\\applications\\com.imdb.mobile.apk", true, true);
C# Example
client.Install("c:\\applications\\com.imdb.mobile.apk", true, true);
VBScript Example
client.Install("c:\\applications\\com.imdb.mobile.apk", true, true);
Python Example
self.client.install2("c:\\applications\\com.imdb.mobile.apk", True, True);
Perl Example
$client->install2("c:\\applications\\com.imdb.mobile.apk", 1, 1);
RFT Example
client.install("c:\\applications\\com.imdb.mobile.apk", true, true);
VUGen Example
ic_install(&c, "c:\\applications\\com.imdb.mobile.apk", IC_TRUE, IC_TRUE);

Install from URL

Scenario: In the following example we will use the 'Install' command with a path to IMDb apk available at a specific url. We will set the instrument parameter to true to instrument the app during installation.

Note: Supported only for .ipa, .apk and .xap files.

Supported in iOS Supported in Android

Parameters:


Notes:

  1. If authentication is needed, user can set the username and password in the URL like:http://username:password@www.buildserver.com/application.apk
  2. Whenever the appPath supplied by the USER  doesn’t contain a supported URL prefix the command will look for an app package on the local machine.


Code Examples

Java Example
client.install("http://192.168.1.234/Application%20Collection/com.imdb.mobile-1.apk", true, true);
C# Example
client.Install("http://192.168.1.234/Application%20Collection/com.imdb.mobile-1.apk", true, true);
VBScript Example
client.Install("http://192.168.1.234/Application%20Collection/com.imdb.mobile-1.apk", true, true );
Python Example
self.client.install2("http://192.168.1.234/Application%20Collection/com.imdb.mobile-1.apk", True, True);
Perl Example
$client->install2("http://192.168.1.234/Application%20Collection/com.imdb.mobile-1.apk", 1, 1);
RFT Example
client.install("http://192.168.1.234/Application%20Collection/com.imdb.mobile-1.apk", true, true);
VUGen Example
ic_install(&c, "http://192.168.1.234/Application%20Collection/com.imdb.mobile-1.apk", IC_TRUE, IC_TRUE);

Install from cloud with unique name

Scenario: In the following example we will use the application unique name

Parameters:

  • Path: Application unique name – set to cloud:uniqueName=<Unique name>
  • instrument:Will be set to True
  • KeepData: Will be set to True

How to upload application to cloud with unique name

Code Examples

Java Example
client.install("cloud:uniqueName=<Unique name>", true, true);
C# Example
client.Install("cloud:uniqueName=<Unique name>", true, true);
VBScript Example
client.Install("cloud:uniqueName=<Unique name>", true, true);
Python Example
self.client.install2("cloud:uniqueName=<Unique name>", True, True);
Perl Example
$client->install2("cloud:uniqueName=<Unique name>", 1, 1);
RFT Example
client.install("cloud:uniqueName=<Unique name>", true, true);
VUGen Example
ic_install(&c, "cloud:uniqueName=<Unique name>", IC_TRUE, IC_TRUE);

Possible Issues

Download Issues

  • Download stops in the middle: Command failure.
    Response: Download failure error message.
  • Download process takes a long time.
    Response: Message indicating long timeout: Command failure.
  • URL is not valid: Command failure.
    Response: URL related error message.
  • Authentication failure: Command failure.
    Response: Message indicating unauthorized download due to wrong credentials.                 

Instrumentation & Import Issues

  • Instrumentation failure.
  • Downloaded app is not compatible to the device’s OS.
    Response: Instrument and import the downloaded app anyway (command will fail on installation).

General Install Issues

  • Downloaded app is not compatible to the device’s OS: Command failure.
    Response: OS related error message.
  • SDK is not compatible with the downloaded app: Command failure.
    Response: SDK related error message.
  • iOS device is not included in the provision: Command failure.
    Response: Provision related error message.


Android specific install error messages

Following is a list of some of the adb install error messages and their solutions if possible:

  • INSTALL_FAILED_UPDATE_INCOMPATIBLE 

Cause: happens when keepdata=true and the app's signature you wish to upgrade is incompatible with the currently installed version.

Solution: solution differs up to your needs:

  1. if you want to update your app (i.e. flag keepData=true) then you need to careful that the app you want to install is signed with the same keystore as the currently installed version.  Please note that if you do instrumentation (i.e. flag instrument=true) , SeeTest re-signs your app with new keystore (SeeTest's default keystore). Therefore, if your original app - the non-instrumented version - is currently installed on your device, you can update it either with:
    •  Another non-instrumented version (i.e. flag instrument=false with a link to your original app) 
    •  An instrumented version (i.e. flag instrument=trueby providing your original app's keystore using InstallWithCustomKeystore command.

2. a simple solution will be to use keepData = false, which will uninstall the currently installed app, and then re-install it. This is if you don't care about the data cache option.


  • INSTALL_FAILED_OLDER_SDK:

    Cause: happens when the app is incompatible with (android:minSdkVersion  is higher than) the device's actual sdk level.

    Solution: No solution on SeeTest level, only workarounds involving modifying android:minSdkVersion the manifest of the APK file .

                   Note: Generally, apps which are incompatible with the device's sdk level do not show up in the device's app store.

  • INSTALL_FAILED_DUPLICATE_PERMISSION:

    Cause: happens when the app you want to install holds a permission android:protectionLevel="signature"A permission that the system grants only if the requesting application is signed with the same certificate as the application that declared the permission. If the certificates match, the system automatically grants the permission without notifying the user or asking for the user's explicit approval. 

    Solution: Sign both applications; the application that declared the permission and the one that holds the permission with the same keystore. 


Note: the keystore file which signs the apps must be generated on the same machine , i.e. if you install with instrument=true one app from a local machine and another app from remote machine (cloud) using SeeTest's default keystore, your apps will be signed with a different certificates, because the keystore files were generated on different machines despite the fact that the keystore files hold the same passwords or alias.


  • INSTALL_FAILED_VERSION_DOWNGRADE: 


Cause: happens when the app's version you want to install is lower than the currently installed app version. This error happens only on devices version 7.0 or higher, due to the new Android  update which does not allow version downgrade on 'un-debuggable' apps.

Solution:  No solution on SeeTest level, only to transform your app into a 'debuggable' app - i.e. add android:debuggable="true" to the manifest of the APK file.


  • INSTALL_FAILED_ALREADY_EXISTS:

Cause: happens when you try to install with keepData=false, whereas the app is currently is already installed on the device. 

Solution:  This error should not happen. SeeTest automatically uninstalls the app pre-installation when your install parameter keepData=false. But if this error popups despite that, this means that the un-installation has failed on SeeTest not the install. try to uninstall the app through adb, if this succeeds, then you should contact your support.




  • No labels