Greenspector Documentation has been moved.
Please go to
https://greenspectorstudio.atlassian.net/l/cp/TDhqYDSu
Test Runner
Up TO DATE
- 1 Test Runner description
- 1.1 General behavior
- 1.2 Job types
- 2 Configuration files
- 2.1 config.yml
- 2.2 job.yml
- 3 Command Line Arguments
- 3.1 Command Line Sub Commands
- 3.1.1 Update components:
- 3.1.2 Measure with a free run:
- 3.1.3 Test a DSL Command :
- 3.1.4 Monitore packages :
- 3.1.4.1 Installation
- 3.1.4.2 Limitations
- 3.1 Command Line Sub Commands
- 4 Results
- 5 Related articles
Test Runner description
General behavior
The Test Runner:
reads the configuration files (config.yml and job.yml);
checks the components are installed;
downloads the components if they are not present or not up to date;
starts the job;
sends the results to the GREENSPECTOR Server or saves them locally when the job is finished.
Job types
With the Test Runner, you will be able to launch 4 different kinds of jobs:
APK job to benchmark your Android application.
URL job to benchmark your website.
CUSTOM job to measure your Android application or web application with your own automated tests.
FREERUN job to run a manual measure of your application or website.
Configuration files
You will find below a reference guide for the 2 configuration files used by the Test Runner.
config.yml
Field in configuration file | Whether the field is necessary depending on the type of job (apk, custom or url) | Description | Default or example value | ||
---|---|---|---|---|---|
| ALL | The platform on which the tests will run. |
| ||
| ALL | The path where you want the Test Runner to save the results. |
| ||
| ALL | The path where components used by the Test Runner are installed. |
| ||
| Informations on your GREENSPECTOR profile. | ||||
| ALL | Your GREENSPECTOR Server URL. | |||
| ALL | Your private token registered on GREENSPECTOR Server. |
| ||
| The proxy may be automatically detected. If not, please configure these fields if you are using a proxy server. In windows, Test Runner automatically detects In linux or mac, Test Runner automatically detects env variable | ||||
| ALL | The protocol used by the proxy. |
| ||
| ALL | The proxy's URL. | |||
| ALL | The port used by the proxy server. | |||
| ALL | The username you are using to connect to the proxy server. | |||
| ALL | The password associated with this username. | |||
| Contains the settings of the targeted platform | ||||
| ALL | The way you are connected to the device. |
| ||
| ALL | The mobile device id, can be retrieved with | |||
| ALL | The mobile IP adress on your Wi-Fi network, can be retrieved with | |||
| ALL | The mobile remote port for adb on your Wi-Fi network. Use this if you previously set connection value to |
| ||
disconnectAfterTest | ALL | This is an optional parameter. When using adb wifi, by default Test Runner disconnect adb at the end of the test. To keep the connection at the end, please set disconnectAfterTest to false | |||
| The paths to required Android SDK's tools. | ||||
| ALL | Path to ADB (Android Debug Bridge). |
| ||
| ALL | Path to AAPT (Android Asset Packaging Tool). |
| ||
| For module | ||||
| URL | The path to the phantomas executable if not already in your path. |
| ||
| Contains information about your physical measurement tool | ||||
| ALL | USB port which the physical probe is connected to |
| ||
setupCommands | ALL | You can provide any useful shell commands that will run on the device before each iteration of testing. Use this parameter if your device needs to be prepared before each iteration and you do not want to prepare it with your GDSL ou UI Automator test. | setupCommands: - settings put global verifier_verify_adb_installs 0 - sh /sdcard/myscript.sh |
job.yml
Field in configuration file | Whether the field is necessary depending on the type of job (apk, custom or url) | Description | Default or example value | ||
---|---|---|---|---|---|
mode | ALL | The type of job you want to lauch, as explained above. |
| ||
greenspector | This block contains details about the GREENSPECTOR application in which you want to save your measures. | ||||
application | |||||
name | ALL | The name of the application . | |||
version | ALL | The version of the application. | |||
job | The job definition. | ||||
url | APKURL | If you previously set Otherwise it is an URL pointing to your Android APK. You can precise a local path to your apk, a public URL to download your apk, a package name if you want to benchmark an already installed apk or a package name if you want to install from the PlayStore before running the test | You can choose an URL :
| ||
urls | APKCUSTOM | You can provide a list of APKs to be installed and eventually measured. You can precise a local path to your apk, a public URL to download your apk, a package name if you want to benchmark an already installed apk or a package name if you want to install from the PlayStore before running the test When using | for each url you can choose the location :
| ||
testPackages | CUSTOM | If you previously set mode to | |||
testsSuites | CUSTOM | If you previously set mode to | For example : testsSuites: | ||
monitoredPackages | CUSTOMFREERUN | If you previously set mode to | |||
monitoredPackage (Deprecated) | CUSTOMFREERUN | If you previously set mode to This field is deprecated, prefer to use monitoredPackages | |||
extras | CUSTOM | Use to transmit extras parameters to your instrumentation with the format key, value
https://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner) | You can use custom parameters like this : extras: If you use custom UIAutomator tests (no GDSL tests) you can filter the class you launch by annotation : extras: (this extra parameter will be added to your uiautomator instrumentation like this -e annotation com.greenspector.demo.test.MyAnnotation) | ||
networkMode | APKURLCUSTOM | The networkMode of the test. The phone has to be able to handle the networkMode. | WIFI, 4G, 3G or 2G. Default value is WIFI. | ||
| scenario | APKURL | Possible value is APK job / simple scenario (deprecated) :
URL job / simple scenario (deprecated) :
URL job / avance scenario:
|
| |
iterations | ALL | How many times you want to run the scenario. | |||
testTimeout | ALL | Timeout for the total duration of the test. Default value is |
| ||
stepName | FREERUN | Name of the step | |||
duration | FREERUN | Duration of the test. |
| ||
authentication | If you previously set mode to | ||||
actions | APK | Set of actions to interact with the authentication form, either by coordinates or by IDs. There is currently two types of actions: |
| ||
browser | URL | If you previously set mode to Only Google Chrome is supported for now. |
| ||
cache | URL | If you previously set mode to | |||
online | ALL | Set this to true if you want the Test Runner to automatically send the results of the measures to your GREENSPECTOR Server. Otherwise, set it to | |||
modules | |||||
http_request | URL | Set this to true to enable analysis of HTTP requests. | |||
android_system_monitoring | APKURLCUSTOM | Set this to true to enable collection of additional system metrics during the job. | |||
hardware_probe | APKURLCUSTOM | Set this to true to enable physical measurement | |||
wakelock_probe | APKURLCUSTOM | Set this to true to enable wakelock measurement for the first iteration |
Command Line Arguments
The Test Runner can take some command line arguments, for now the following are supported:
--config anotherConfigFile
→ to specify an alternative config.yml file;--jobFile anotherJobFile
→ to specify an alternative job.yml file.--
no-update → to prevent automatically update the components used by the Test Runner when you run it (prefer not using this option)
These can be useful when you want to use different configurations for different kinds of tests. For example:
./testrunner --config androidConfig.yml --jobFile androidAPKJob.yml
./testrunner --config androidConfig.yml --jobFile androidURLJob.yml
You can also use these arguments with the update
command:
./testrunner --config androidConfig.yml --jobFile androidURLJob.yml update
Command Line Sub Commands
The Test Runner has subcommands:
Update components:
To update the components of GREENSPECTOR and use the last measure tools, you should run the command:
./testrunner update
This command will download the last android-service
and testbench-launcher-android
in the folder $HOME/.greenspector
. These components will be installed on your phone before running a job.
This command is not necessary anymore if you do not use the option --no-update in your command, Test Runner will update these components automatically
Measure with a free run:
The Test Runner allows you to run a measure for a duration of time, while you can use the application you want to monitor. To do so, you should run the following commands:
This command will start a measure with no automated actions on the device so that you can run your manual scenario while monitoring your application.
Test a DSL Command :
The Test Runner allow you to test one command writen with Greenspector DSL for Android
Monitore packages :
You can use the Test Runner to install an application that you can use to run measurements on a device. The operation is similar to free run, except you don't have to use the Test Runner to launch it once it's installed on your device.
Installation
Once you have downloaded the Test Runner, you can install the monitoring application on any device you want (you have to have unlocked developer mode on the device and be connected to it via adb).
Prerequisite
You have to have a config file filled with the right information (url, token, connection information about the device...). You can check the syntax of the file above.
You also have to decide which package are to be monitored. For example, you can monitore com.android.chrome, a specific application pacakge or the android system (com.android.systemui). You can monitore multiple packages.
Command line
Start and stop measure
Once the application is installed, you can click on the icon to open it.
The button "Start measure" starts a measure and closes the application.
The button "Stop measure" stops the measure. A default name will be given if you don't name the measure before stopping it.
Get results in CSV or send them to the web interface
At the end of the measure, you can either retrieve the results in a CSV file, or send them to the web interface. Both operations delete the results from the device.
You have to have created the application you want to send to measures to before.
Limitations
The application has to be reinstalled every time the device is rebooted (to restart the monitoring service).
The application has to be reinstalled if you want to monitor another package (and the new package to monitor has to be part of the install command line.
If you launch a new measure after stopping one, the results from the previous run will be erased and replaced by the new measure.
Results
When a job is finished, if you configured the online flag in your job.yml to true, the Test Runner will automatically send the measures to your GREENSPECTOR Server.
Otherwise, results will be saved locally to the resultPath you set in config.yml, allowing you to send them later using the GREENSPECTOR Command Line Interface.