Launch with Options
SeeTest allows you to pass Environment variables and command-line arguments to the application during the launch process.
Users are required to pass the environment variables or command-line arguments as a JSON of the key-value set which is passed to the application
There is 2 launch with options command that exists in SeeTest.
1.) launch(String applicationIdentifier, Map launchOptions) :- This command takes application Identifier and launchOptions as MAP
2.) launchWithOptions(String applicationIdentifier, String launchOptionsJSON) :- This command takes application identifier and launchOptions as JSON String.
While SeeTest Client support both the commands, SeeTest Appium Extension does not support the First command. If you want to use launch with options with SeeTest Appium extension, you have to use the second command with JSON Parameter.
Supported Keys
Key | Type | Description | OS |
---|---|---|---|
relaunch | boolean | Whether or not to kill the application in case it is running | Android & iOS |
instrument | boolean | Launch the application in an instrumented mode | Android |
launch_args | JSON Array | An ordered array of command line args | iOS |
launch_env | JSON Object | Set of key = value pairs that will be passed as Environment variables to the application | iOS |
verify | boolean | Whether or not to verify that the application is still in the foreground when the launch ends. If not specified, defaults to true. Set this option to false if the application is not expected to stay in the foreground after it is launched. | iOS |
initial_wait | boolean | Whether or not to wait for the application to launch and idle. If not specified, defaults to true. Set this option to false in order to speed up the launch process, and not wait for the application to idle. If set to false, it is client responsibility to handle synchronisation issues and verify launch succeeded. | iOS |
<adb-option-key> | <adb-option-value> | key-value pairs of adb extra options | Android |
- Instrumentation in iOS is determined during installation.
The examples below show a couple of use cases for this feature for users who are using JAVA and Ruby Clients.
Replace <server> with the appropriate URL.
- Public Continuous Testing Cloud - https://cloud.seetest.io/wd/hub/.
- Dedicated Continuous Testing Cloud environment - Your own domain. For example: https://company.experitest.com/wd/hub/
- On-premises Continuous Testing Cloud environment - Your designated URL. For example: https://company.com/wd/hub
Example - Java launch iOS App with options and pass JSON as environment variables
DesiredCapabilities dc = new DesiredCapabilities();
dc.setCapability(MobileCapabilityType.UDID, "<Device_ID>");
driver = new AndroidDriver(new URL("<server>"), dc);
client = new SeeTestClient(driver);
JsonObject launchOptions = new JsonObject();
launchOptions.addProperty("relaunch", true);
// Create ENV vars JSON Object to pass to the application so it will run in DEBUG with a secret key
JsonObject envVars = new JsonObject();
envVars.addProperty("secret_key", "DFSF5343543CAA");
envVars.addProperty("DEBUG", true);
launchOptions.add("launch_env",envVars);
client.launchWithOptions("com.experitest.ExperiBank", launchOptions.toString());
Example - Java launch Android App with adb options
DesiredCapabilities dc = new DesiredCapabilities();
dc.setCapability(MobileCapabilityType.UDID, "<Device_ID>");
driver = new AndroidDriver(new URL("<server>"), dc);
client = new SeeTestClient(driver);
// Launch app as non-instrumented, use relaunch
JsonObject launchOptions = new JsonObject();
launchOptions.addProperty("instrumented", false);
launchOptions.addProperty("relaunch", true);
// Add adb params
launchOptions.addProperty("-D", "");
launchOptions.addProperty("--es", "android.intent.extra.TEXT Hello");
client.launchWithOptions("com.experitest.ExperiBank/.LoginActivity",launchOptions.toString());
- In iOS:
When passing to the application ENV vars or CMD line ARGS Make sure that you also pass the key "relaunch" with value `true` so that the application will be able to parse these arguments
- In Android:
Options are:
-
-
-D
: Enable debugging.-W
: Wait for launch to complete.--start-profiler file
: Start profiler and send results tofile
.-P file
: Like--start-profiler
, but profiling stops when the app goes idle.-R count
: Repeat the activity launchcount
times. Prior to each repeat, the top activity will be finished.-S
: Force stop the target app before starting the activity.--opengl-trace
: Enable tracing of OpenGL functions.--user user_id | current
: Specify which user to run as; if not specified, then run as the current user.- --es: extra custom options
-