Setup automation test script
As mentioned in Prerequisite, in order to execute automation test scripts using Azure Devops Kobiton Extension, we need to prepare a Git repository contains your Automation test scripts. Additionally, we should make some small adjustments to your test script. Setting up environment variables to consumed device and app input from Kobiton Extension to your script.
-
Kobiton API credentials
For automation test script, please set your Kobiton Username and API Key in your automation test setting code like below:
String kobitonServerUrl = "https://" + System.getenv("KOBITON_USERNAME") + ":" + System.getenv("KOBITON_API_KEY") + "@api.kobiton.com/wd/hub";
-
Kobiton Devices
If you are using Kobiton Cloud for testing, please set device-replated values in desiredCaps like below:
While using Kobiton Cloud Devices, make sure to set the deviceGroup field in your desiredCaps to "KOBITON."capabilities.setCapability("deviceGroup", "KOBITON"); capabilities.setCapability("deviceName", System.getenv("KOBITON_DEVICE_NAME")); capabilities.setCapability("platformName", System.getenv("KOBITON_DEVICE_PLATFORM_NAME"));
-
Aplication
Set the app field in your desiredCaps with the following environment variables:
capabilities.setCapability("app", (System.getenv("KOBITON_SESSION_APPLICATION")
-
You can also hard-code the default values for these paramaters to avoid failing the test case.
Environment | Description |
---|---|
KOBITON_USERNAME | The Kobiton Username you set in Azure Service conneciton |
KOBITON_API_KEY | The Kobiton API Key you set in Azure Service connection |
KOBITON_DEVICE_NAME | Value of the device name in Kobiton Extension Task |
KOBITON_SESSION_PLATFORM_VERSION | Value of the device platform in Kobiton Extension Task |
KOBITON_DEVICE_PLATFORM_NAME | Value of the device platform in Kobiton Extension Task (Android/IOS) |
KOBITON_SESSION_APPLICATION | Value of the app in Kobiton Extension Task |
We have a sample project which using above enviroment value. You can see here.
Once you have your Git repository configure, let's move to the next step.
COMMENT