DeployOnStart Property

Applies to TestComplete 15.20, last modified on January 19, 2022

Description

Specifies whether an Android tested application or an iOS tested application should be automatically installed to the device on each start. The property value corresponds to the Deploy to the device on start option specified for the application in the TestedApps editor.

TestComplete does not check if the application is already installed to the device. Therefore, some user-specific data can be lost during reinstalling the application.

Declaration

TestedAppObj.DeployOnStart

Read-Write Property Boolean
TestedAppObj An expression, variable or parameter that specifies a reference to a TestedApp object

Applies To

The property is applied to the following objects:

Property Value

True, if the application's Deploy to the device on start option is enabled; False otherwise.

Remarks

If an Android tested application is already installed on the device, TestComplete deletes it before deploying. You can specify whether to delete the application’s user-specific data and cache, or save it while the package is being deleted. For more information, see the description of the AndroidTestedApp.KeepDataAndCache property.

Example

The sample code below demonstrates how to add a new Android application to the list of tested applications, specify the application’s properties and run the application.

JavaScript, JScript

function AddAndroidApplication()
{

  // Sets the current device
  Mobile.SetCurrent("MyDevice");

  // Adds the Android application from the package and obtains its index in the list of tested applications
  var ind = TestedApps.AddAndroidApp("C:\\Android\\apks\\SampleApp.apk");

  // Obtains the added tested application by its index and specifies its properties
  var AndroidTestedApp = TestedApps.Items(ind);
  AndroidTestedApp.DeployOnStart = true;
  AndroidTestedApp.Launch = true;
  AndroidTestedApp.GrantPermissions = true;
  AndroidTestedApp.KeepDataAndCache = false;
  
  // Checks if the applications is instrumented
  if (!AndroidTestedApp.Instrumented)
  {
    // Sets up custom certificate parameters
    AndroidTestedApp.UseCustomCertificate = true;
    AndroidTestedApp.KeystorePath = "C:\\Android\\Keystore";
    AndroidTestedApp.KeystorePassword = "KstrPass";
    AndroidTestedApp.Alias = "KeyAlias";
    AndroidTestedApp.KeyPassword = "KeyPass";
  }

  // Checks if TestComplete can work with the instrumented application
  if (AndroidTestedApp.InstrumentedWithSupportedVersion)
  {
    // Launches the application
    AndroidTestedApp.Run();
  }
  else
  {
    // Posts an error to the log
    Log.Error("Please use uninstrumented application or application instrumented for the current TestComplete version");
  }
}

Python

def AddAndroidApplication():
  # Sets the current device
  Mobile.SetCurrent("MyDevice")

  # Adds the Android application from the package and obtains its index in the list of tested applications
  ind = TestedApps.AddAndroidApp("C:\\Android\\apks\\SampleApp.apk")

  # Obtains the added tested application by its index and specifies its properties
  AndroidTestedApp = TestedApps.Items[ind]
  AndroidTestedApp.DeployOnStart = True
  AndroidTestedApp.Launch = True
  AndroidTestedApp.GrantPermissions = True
  AndroidTestedApp.KeepDataAndCache = False
   
  # Checks if the applications is instrumented
  if (not AndroidTestedApp.Instrumented):
    # Sets up custom certificate parameters
    AndroidTestedApp.UseCustomCertificate = True
    AndroidTestedApp.KeystorePath = "C:\\Android\\Keystore"
    AndroidTestedApp.KeystorePassword = "KstrPass"
    AndroidTestedApp.Alias = "KeyAlias"
    AndroidTestedApp.KeyPassword = "KeyPass"

  # Checks if TestComplete can work with the instrumented application
  if (AndroidTestedApp.InstrumentedWithSupportedVersion):
    # Launches the application
    AndroidTestedApp.Run()
  else:
   # Posts an error to the log
   Log.Error("Please use uninstrumented application or application instrumented for the current TestComplete version")

VBScript

Sub AddAndroidApplication

  ' Sets the current device
  Mobile.SetCurrent("MyDevice")

  ' Adds the Android application from the package and obtains its index in the list of tested applications
  ind = TestedApps.AddAndroidApp("C:\Android\apks\SampleApp.apk")

  ' Obtains the added tested application by its index and specifies its properties
  Set AndroidTestedApp = TestedApps.Items(ind)
  AndroidTestedApp.DeployOnStart = True
  AndroidTestedApp.Launch = True
  AndroidTestedApp.GrantPermissions = True
  AndroidTestedApp.KeepDataAndCache = False
  
  ' Checks if the applications is instrumented
  If not AndroidTestedApp.Instrumented Then
    ' Sets up custom certificate parameters
    AndroidTestedApp.UseCustomCertificate = true
    AndroidTestedApp.KeystorePath = "C:\Android\Keystore"
    AndroidTestedApp.KeystorePassword = "KstrPass"
    AndroidTestedApp.Alias = "KeyAlias"
    AndroidTestedApp.KeyPassword = "KeyPass"
  End If

  ' Checks if TestComplete can work with the instrumented application
  If AndroidTestedApp.InstrumentedWithSupportedVersion Then
    ' Launches the application
    AndroidTestedApp.Run()
  Else
    ' Posts an error to the log
    Log.Error("Please use uninstrumented application or application instrumented for the current TestComplete version")
  End If
End Sub

DelphiScript

procedure AddAndroidApplication();
var 
  ind, AndroidTestedApp;
begin

  // Sets the current device
  Mobile.SetCurrent('MyDevice');

  // Adds the Android application from the package and obtains its index in the list of tested applications
  ind := TestedApps.AddAndroidApp('C:\Android\apks\SampleApp.apk');

  // Obtains the added tested application by its index and specifies its launch properties
  AndroidTestedApp := TestedApps.Items[ind];
  AndroidTestedApp.DeployOnStart := true;
  AndroidTestedApp.Launch := true;
  AndroidTestedApp.GrantPermissions := true;

  AndroidTestedApp.KeepDataAndCache := false;

  // Checks if the applications is instrumented
  if not AndroidTestedApp.Instrumented then
  begin
    // Sets up custom certificate parameters
    AndroidTestedApp.UseCustomCertificate := true;
    AndroidTestedApp.KeystorePath := 'C:\Android\Keystore';
    AndroidTestedApp.KeystorePassword := 'KstrPass';
    AndroidTestedApp.Alias := 'KeyAlias';
    AndroidTestedApp.KeyPassword := 'KeyPass';
  end;

  // Checks if TestComplete can work with the instrumented application
  if AndroidTestedApp.InstrumentedWithSupportedVersion then
    // Launches the application
    AndroidTestedApp.Run()
  else
    // Posts an error to the log
    Log.Error('Please use uninstrumented application or application instrumented for the current TestComplete version');
end;

C++Script, C#Script

function AddAndroidApplication()
{

  // Sets the current device
  Mobile["SetCurrent"]("MyDevice");

  // Adds the Android application from the package and obtains its index in the list of tested applications
  var ind = TestedApps["AddAndroidApp"]("C:\\Android\\apks\\SampleApp.apk");

  // Obtains the added tested application by its index and specifies its properties
  var AndroidTestedApp = TestedApps["Items"](ind);
  AndroidTestedApp["DeployOnStart"] = true;
  AndroidTestedApp["Launch"] = true;
  AndroidTestedApp["GrantPermissions"] = true;
  AndroidTestedApp["KeepDataAndCache"] = false;
  
  // Checks if the applications is instrumented
  if (!AndroidTestedApp["Instrumented"])
  {
    // Sets up custom certificate parameters
    AndroidTestedApp["UseCustomCertificate"] = true;
    AndroidTestedApp["KeystorePath"] = "C:\\Android\\Keystore";
    AndroidTestedApp["KeystorePassword"] = "KstrPass";
    AndroidTestedApp["Alias"] = "KeyAlias";
    AndroidTestedApp["KeyPassword"] = "KeyPass";
  }

  // Checks if TestComplete can work with the instrumented application
  if (AndroidTestedApp["InstrumentedWithSupportedVersion"])
  {
    // Launches the application
    AndroidTestedApp["Run"]();
  }
  else
  {
    // Posts an error to the log
    Log["Error"]("Please use uninstrumented application or application instrumented for the current TestComplete version");
  }
}

The sample code below demonstrates how to add a new iOS application to the list of tested applications, specify the application’s properties and run the application.

JavaScript, JScript

function AddiOSApplication()
{

  // Sets the current device
  Mobile.SetCurrent("MyDevice");

  // Adds the iOS application from the package and obtains its index in the list of tested applications
  var ind = TestedApps.AddiOSApp("C:\\iOS\\ipas\\SampleApp.ipa");

  // Obtains the added tested application by its index and specifies its properties
  var iOSTestedApp = TestedApps.Items(ind);
  iOSTestedApp.DeployOnStart = true;
  iOSTestedApp.Launch = true;
  
  // Checks if the applications is instrumented
  if (!iOSTestedApp.Instrumented)
  {
    // Sets up backup parameters
    iOSTestedApp.BackupOriginalIPA = true;
    iOSTestedApp.BackupFileName = "C:\\iOS\\ipas\\SampleApp_ORIGINAL_BACKUP.ipa";
    // Sets up paths to certificate files
    iOSTestedApp.AppleWWDRCAPath = "C:\\iOS\\AppleWWDRCA.cer";
    iOSTestedApp.DeveloperCertPath = "C:\\iOS\\Certificates.cer";
    iOSTestedApp.DeveloperPemPath = "C:\\iOS\\Certificates.pem";
    iOSTestedApp.ProvisioningPath = "C:\\iOS\\iOS_Provisioning_Profile.mobileprovision";
    iOSTestedApp.Instrument();
  }

  // Checks if TestComplete can work with the instrumented application
  if (iOSTestedApp.InstrumentedWithSupportedVersion)
  {
    // Launches the application
    iOSTestedApp.Run();
  }
  else
  {
    // Posts an error to the log
    Log.Error("Please use uninstrumented application or application instrumented for the current TestComplete version");
  }
}

Python

def AddiOSApplication():

  # Sets the current device
  Mobile.SetCurrent("MyDevice")

  # Adds the iOS application from the package 
  # and obtains its index in the list of tested applications
  ind = TestedApps.AddiOSApp("C:\\iOS\\ipas\\SampleApp.ipa")

  # Obtains the added tested application by its index 
  # and specifies its properties
  iOSTestedApp = TestedApps.Items(ind)
  iOSTestedApp.DeployOnStart = True
  iOSTestedApp.Launch = True
  
  # Checks if the applications is instrumented
  if not iOSTestedApp.Instrumented:
    # Sets up backup parameters
    iOSTestedApp.BackupOriginalIPA = True
    iOSTestedApp.BackupFileName = "C:\\iOS\\ipas\\SampleApp_ORIGINAL_BACKUP.ipa"
    # Sets up paths to certificate files
    iOSTestedApp.AppleWWDRCAPath = "C:\\iOS\\AppleWWDRCA.cer"
    iOSTestedApp.DeveloperCertPath = "C:\\iOS\\Certificates.cer"
    iOSTestedApp.DeveloperPemPath = "C:\\iOS\\Certificates.pem"
    iOSTestedApp.ProvisioningPath = "C:\\iOS\\iOS_Provisioning_Profile.mobileprovision"
    # Instruments the application
    iOSTestedApp.Instrument()

  # Checks if TestComplete can work with the instrumented application
  if iOSTestedApp.InstrumentedWithSupportedVersion:
    # Launches the application
    iOSTestedApp.Run()
  else:
    # Posts an error to the log
    Log.Error("Please use uninstrumented application or application \
      instrumented for the current TestComplete version")

VBScript

Sub AddiOSApplication

  ' Sets the current device
  Mobile.SetCurrent("MyDevice")

  ' Adds the iOS application from the package and obtains its index in the list of tested applications
  ind = TestedApps.AddiOSApp("C:\iOS\ipas\SampleApp.ipa")

  ' Obtains the added tested application by its index and specifies its properties
  Set iOSTestedApp = TestedApps.Items(ind)
  iOSTestedApp.DeployOnStart = True
  iOSTestedApp.Launch = True
  
  ' Checks if the applications is instrumented
  If not iOSTestedApp.Instrumented Then
    ' Sets up backup parameters
    iOSTestedApp.BackupOriginalIPA = true
    iOSTestedApp.BackupFileName = "C:\iOS\ipas\SampleApp_ORIGINAL_BACKUP.ipa"
    ' Sets up paths to certificate files
    iOSTestedApp.AppleWWDRCAPath = "C:\iOS\AppleWWDRCA.cer"
    iOSTestedApp.DeveloperCertPath = "C:\iOS\Certificates.cer"
    iOSTestedApp.DeveloperPemPath = "C:\iOS\Certificates.pem"
    iOSTestedApp.ProvisioningPath = "C:\iOS\iOS_Provisioning_Profile.mobileprovision"
    ' Instruments the application
    iOSTestedApp.Instrument()
  End If

  ' Checks if TestComplete can work with the instrumented application
  If iOSTestedApp.InstrumentedWithSupportedVersion Then
    ' Launches the application
    iOSTestedApp.Run()
  Else
    ' Posts an error to the log
    Log.Error("Please use uninstrumented application or application instrumented for the current TestComplete version")
  End If
End Sub

DelphiScript

procedure AddiOSApplication();
var 
  ind, iOSTestedApp;
begin

  // Sets the current device
  Mobile.SetCurrent('MyDevice');

  // Adds the iOS application from the package and obtains its index in the list of tested applications
  ind := TestedApps.AddiOSApp('C:\iOS\ipas\SampleApp.ipa');

  // Obtains the added tested application by its index and specifies its launch properties
  iOSTestedApp := TestedApps.Items[ind];
  iOSTestedApp.DeployOnStart := true;
  iOSTestedApp.Launch := true;

  // Checks if the applications is instrumented
  if not iOSTestedApp.Instrumented then
  begin
    // Sets up backup parameters
    iOSTestedApp.BackupOriginalIPA := true;
    iOSTestedApp.BackupFileName := 'C:\iOS\ipas\SampleApp_ORIGINAL_BACKUP.ipa';
    // Sets up paths to certificate files
    iOSTestedApp.AppleWWDRCAPath := 'C:\iOS\AppleWWDRCA.cer';
    iOSTestedApp.DeveloperCertPath := 'C:\iOS\Certificates.cer';
    iOSTestedApp.DeveloperPemPath := 'C:\iOS\Certificates.pem';
    iOSTestedApp.ProvisioningPath := 'C:\iOS\iOS_Provisioning_Profile.mobileprovision';
    // Instruments the application
    iOSTestedApp.Instrument();
  end;

  // Checks if TestComplete can work with the instrumented application
  if iOSTestedApp.InstrumentedWithSupportedVersion then
    // Launches the application
    iOSTestedApp.Run()
  else
    // Posts an error to the log
    Log.Error('Please use uninstrumented application or application instrumented for the current TestComplete version');
end;

C++Script, C#Script

function AddiOSApplication()
{

  // Sets the current device
  Mobile["SetCurrent"]("MyDevice");

  // Adds the iOS application from the package and obtains its index in the list of tested applications
  var ind = TestedApps["AddiOSApp"]("C:\\iOS\\ipas\\SampleApp.ipa");

  // Obtains the added tested application by its index and specifies its properties
  var iOSTestedApp = TestedApps["Items"](ind);
  iOSTestedApp["DeployOnStart"] = true;
  iOSTestedApp["Launch"] = true;
  
  // Checks if the applications is instrumented
  if (!iOSTestedApp["Instrumented"])
  {
    // Sets up backup parameters
    iOSTestedApp["BackupOriginalIPA"] = true;
    iOSTestedApp["BackupFileName"] = "C:\\iOS\\ipas\\SampleApp_ORIGINAL_BACKUP.ipa";
    // Sets up paths to certificate files
    iOSTestedApp["AppleWWDRCAPath"] = "C:\\iOS\\AppleWWDRCA.cer";
    iOSTestedApp["DeveloperCertPath"] = "C:\\iOS\\Certificates.cer";
    iOSTestedApp["DeveloperPemPath"] = "C:\\iOS\\Certificates.pem";
    iOSTestedApp["ProvisioningPath"] = "C:\\iOS\\iOS_Provisioning_Profile.mobileprovision";
    // Instruments the application
    iOSTestedApp["Instrument"]();
  }

  // Checks if TestComplete can work with the instrumented application
  if (iOSTestedApp["InstrumentedWithSupportedVersion"])
  {
    // Launches the application
    iOSTestedApp["Run"]();
  }
  else
  {
    // Posts an error to the log
    Log["Error"]("Please use uninstrumented application or application instrumented for the current TestComplete version");
  }
}

See Also

AndroidTestedApp Object
iOSTestedApp Object
KeepDataAndCache Property
About Tested Android Applications (Legacy)
About Tested iOS Applications (Legacy)
About Tested Applications
Run Modes and Parameters
Editing Mobile Application Parameters From Tests

Highlight search results