...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
Status | ||||
---|---|---|---|---|
|
Table of Contents |
---|
Configuration
Client configuration in $HOME/.greenspector/config.yml
The main configuration file must be located in $HOME/.greenspector/config.yml. To initialize it, simply use the command:
Code Block | ||
---|---|---|
| ||
gspt init -a <greenspectorApi> -p <privateToken> |
where:
greenspectorApi
is your GREENSPECTOR Server API URL (for example https://app.greenspector.com/api);privateToken
is your private token, available in the Preferences screen on your GREENSPECTOR Web Interface.
The file $HOME/.greenspector/config.yml should now exists.
...
Status | ||||
---|---|---|---|---|
|
Table of Contents |
---|
Configuration
Client configuration in $HOME/.greenspector/config.yml
The main configuration file must be located in $HOME/.greenspector/config.yml. To initialize it, simply use the command:
Code Block | ||
---|---|---|
| ||
gspt init -a <greenspectorApi> -p <privateToken> |
where:
greenspectorApi
is your GREENSPECTOR Server API URL (for example https://app.greenspector.com/api);privateToken
is your private token, available in the Preferences screen on your GREENSPECTOR Web Interface.
The file $HOME/.greenspector/config.yml should now exists.
To check your configuration, type:
Code Block | ||
---|---|---|
| ||
gspt ping |
This command will tell you whether your basic configuration and credentials are correct or not. If correct, you should have the message "Server pinged with success".
Optional proxy configuration
Info |
---|
The proxy can be automatically detected. In windows, the CLI automatically detects In linux or mac, the CLI automatically detects env variable |
If previous gspt ping does not work in your work office, you probably need to configure a proxy to allow the CLI to access Internet.
You can check if you need to configure a proxy. Use a 4G mobile network for your PC and try to use the CLI. If it works, you need to configure a proxy.
Set the proxyUrl
property simply by using the command:
Code Block | ||
---|---|---|
| ||
gspt set-proxy
or
gspt set-proxy --proxyUrl <proxyUrl> |
If you want more details on this option, you can run the command:
Code Block | ||
---|---|---|
| ||
gspt set-proxy -h |
Example for proxy without authentication:
Code Block | ||
---|---|---|
| ||
gspt set-proxy --proxyUrl "http://testproxy.local:3112/" |
Example for proxy with authentication:
Code Block | ||
---|---|---|
| ||
gspt set-proxy --proxyUrl "http://myuser:mypassword%241%2C%21@testproxy.local:3112/" |
Using --proxyUrl, If you have password with specials characters, you need to encode the password to use as url. You can use this https://smalldev.tools/url-encoder-online
For example, the password mypassword$1,! devient mypassword%241%2C%21
Example for proxy with authentification with interactive mode:
Code Block | ||
---|---|---|
| ||
gspt set-proxy
Enter the Proxy Protocol (http or https)
Proxy Protocol:
http
Enter the Proxy Host
Proxy Host:
testproxy.local
Enter the Proxy Port
Proxy Port:
3112
Is this proxy authenticated? (y/N)
y
Enter the Proxy Username:
myuser
Enter the Proxy Password:
mypassword$1,!
|
You do not need to encode password in this interactive mode
To check your configuration, type:
Code Block | ||
---|---|---|
| ||
gspt ping |
This command will tell you whether your basic configuration and credentials are correct or not. If correct, you should have the message "Server pinged with success".
you can get these errors if you misconfigured your proxy:
Error | Cause |
---|---|
. because an auto detection of your browser is set, you, you can find | Bad port |
Error: Get "https://app.greenspector.com/api/ping": Proxy Authentication Required | Bad user or password |
Error: Get "https://app.greenspector.com/api/ping": proxyconnect tcp: dial tcp 149.202.59.166:3129: i/o timeout | Bad Host |
Error: parse "http://myuser:mypassword": invalid port ":mypassword" after host | Need to encode password |
Error: Get "https://app.greenspector.com/api/ping": proxyconnect tcp: tls: first record does not look like a TLS handshake | Bad protocol, use http instead of https or the opposite |
Tips:
If you do not know the proxy host of your office and your browser is configured automatically to discover the proxy, you can get the following file via your browser :
wpad.<domaine_local>/wpad.dat
Example : https://wpad.myorganisation.fr/wpad.dat
If you open this file, you can find the host and port for the proxy.
Current working folder configuration in $CURRENT_FOLDER/.greenspector/config.yml
In order to be able to use all the features of the GREENSPECTOR CLI, you also need a configuration file in your current working folder ($CURRENT_FOLDER/.greenspector/config.yml). This file contains the following fields:
$CURRENT_FOLDER/.greenspector/config.yml
Code Block | ||
---|---|---|
| ||
application: <name of the application>
version: <version of the application>
environment: <environment to run the tests on>
platform: <platform of the environment (mobile in most cases)>
os: <OS of the environment>
version: <version of this OS>
device: <device name of the environment>
browsers: <list of browsers available on this environment> |
For example:
$CURRENT_FOLDER/.greenspector/config.yml
Code Block | ||
---|---|---|
| ||
application: MyFirstApplication
version: 0.1.2
environment:
platform: mobile
os: android
version: "7"
device: nexus6
browsers:
- chrome |
You do not have to manually edit this configuration file, you can simply initialize it with the command:
Code Block | ||
---|---|---|
| ||
gspt initprojectconfiguration set-proxy or gspt set-proxy --proxyUrl <proxyUrl> |
If you want more details on this option, you can run the command:
Code Block | ||
---|---|---|
| ||
gspt set-proxy -h |
To check your configuration, type:
Code Block | ||
---|---|---|
| ||
gspt ping |
This command will tell you whether your basic configuration and credentials are correct or not.
Current working folder configuration in $CURRENT_FOLDER/.greenspector/config.yml
In order to be able to use all the features of the GREENSPECTOR CLI, you also need a configuration file in your current working folder ($CURRENT_FOLDER/.greenspector/config.yml). This file contains the following fields:
Code Block | ||||
---|---|---|---|---|
| ||||
application: <name of the application>
version: <version of the application>
environment: <environment to run the tests on>
platform: <platform of the environment (mobile in most cases)>
os: <OS of the environment>
version: <version of this OS>
device: <device name of the environment>
browsers: <list of browsers available on this environment> |
For example:
Code Block | |
---|---|
language | text | title | a "<Your application name>" -v "<Your version>"
or
gspt ipc -a "<Your application name>" -v "<Your version>" |
This command will automatically set the fields application
and version
in you configuration file, other fields will be updated when you will start using CLI commands related to the Power Test Bench/Cloud service.
Usage
To use GREENSPECTOR Command Line, go to any folder and type the command:
Code Block | ||
---|---|---|
| ||
gspt <command name> |
You will find below a list of the available commands.
Help
The help of GREENSPECTOR Command Line is built in a tree way. You will only see one help level at a time.
Choose one of the following commands, depending on the level of help you need: general help, command help or subcommand help.
Code Block | ||
---|---|---|
| ||
gspt -h
gspt <command name> -h
gspt <command name> <subcommand name> -h |
Ping
Use this command to test the connection to your GREENSPECTOR Server and check that your settings are correct:
Code Block | ||
---|---|---|
| ||
gspt ping |
Meter
This feature groups all the commands related to the Meter service:
Code Block | ||
---|---|---|
| ||
gspt meter <subcommand name> |
Before using meter
command, you have to define the application and the version you are working on by setting the configuration file in the current folder by following instructions in paragraph CLI#Current working folder configuration in $CURRENT_FOLDER/.greenspector/config.yml
...
application: MyFirstApplication
version: 0.1.2
environment:
platform: mobile
os: android
version: "7"
device: nexus6
browsers:
- chrome
You do not have to manually edit this configuration file, you can simply initialize it with the command:
Code Block | ||
---|---|---|
| ||
gspt initprojectconfiguration -a "<Your application name>" -v "<Your version>"
or
gspt ipc -a "<Your application name>" -v "<Your version>" |
This command will automatically set the fields application
and version
in you configuration file, other fields will be updated when you will start using CLI commands related to the Power Test Bench/Cloud service.
Usage
To use GREENSPECTOR Command Line, go to any folder and type the .
Send measures
Use this subcommand to send the results files from the current folder to the server:
Code Block | ||
---|---|---|
| ||
gspt meter send-measures |
This feature will read all the results files in the current folder and send their contents to your GREENSPECTOR Server.
Please note that these files are deleted when they are successfully sent.
Power Test Cloud/Bench
This feature groups all the commands related to the Power Test Cloud/Bench service:
Code Block | ||
---|---|---|
| ||
gspt testbench <subcommand name> |
Before using testbench
command, you have to define the application and the version you are working on by setting the configuration file in the current folder by following instructions in paragraph CLI#Current working folder configuration in $CURRENT_FOLDER/.greenspector/config.yml.
Set the environment
To use the testbench
command, you first need to set the environment for your project.
To do so, you should use this command:
Code Block | ||
---|---|---|
| ||
gspt <commandtestbench name> |
You will find below a list of the available commands.
Help
The help of GREENSPECTOR Command Line is built in a tree way. You will only see one help level at a time.
...
set-environment |
This command will ask you to select one environment among the available ones on your server. To select one, simply type the number for the environment you want when asked to.
Run a measure on a website (only available for android)
This feature allows you to run a measure of a website on the Power Test Cloud/Bench.
To use this feature, you have to first configure the application name, version and the environment to run the measure on.
The command to run is:
Code Block | ||
---|---|---|
| ||
gspt testbench measure-url --url <Web Site URL> |
Examples:
Code Block | ||
---|---|---|
| ||
gspt -h testbench measure-url --url https://greenspector.com/ gspt <commandtestbench name>measure-url --h gspt <command name> <subcommand name> -h |
Ping
Use this command to test the connection to your GREENSPECTOR Server and check that your settings are correct:
Code Block | ||
---|---|---|
| ||
gspt ping |
Meter
This feature groups all the commands related to the Meter service:
Code Block | ||
---|---|---|
| ||
gspt meter <subcommand name> |
Before using meter
command, you have to define the application and the version you are working on by setting the configuration file in the current folder by following instructions in paragraph 43909160.
Send measures
Use this subcommand to send the results files from the current folder to the server:
Code Block | ||
---|---|---|
| ||
gspt meter send-measures |
This feature will read all the results files in the current folder and send their contents to your GREENSPECTOR Server.
Please note that these files are deleted when they are successfully sent.
Power Test Cloud/Bench
This feature groups all the commands related to the Power Test Cloud/Bench service:
Code Block | ||
---|---|---|
| ||
gspt testbench <subcommand name> |
Before using testbench
command, you have to define the application and the version you are working on by setting the configuration file in the current folder by following instructions in paragraph 43909160.
Set the environment
To use the testbench
command, you first need to set the environment for your project.
To do so, you should use this command:
Code Block | ||
---|---|---|
| ||
gspt testbench set-environment |
This command will ask you to select one environment among the available ones on your server. To select one, simply type the number for the environment you want when asked to.
Run a measure on a website
...
url https://greenspector.com/ --iterations 5 --browser chrome --networkMode 4G
gspt testbench measure-url --url https://www.mozilla.org/fr/ --browser firefox --report |
The options are :
1 - --url
: The URL to benchmark. Mandatory option
2 - --iterations
: Number of iterations of measure you want. (Default: 1). Optional
3 - --browser
: Browser you want to run the measure on. (Default: Google Chrome). Optional
4 - --networkMode: The network mode for the test. Values can be "WIFI", "4G", "3G" or "2G". (Default: WIFI). Optional
5 - --report
: Automatically generate the test report in the .greenspector
folder and wait for the job to end. (Default: false). Optional
This command will send a measure request to the server. After this measure has run on the Power Test Bench/Cloud, you will find the results on the web interface.
Benchmark one or more app (only available for android)
This feature allows you to benchmark your Android application on the Power Test Cloud/Bench.
To use this feature, you have to first configure the application name, version and the environment to run the measure on.
The command to run is:
Code Block | ||
---|---|---|
| ||
gspt testbench measure-url --url <Web Site URL> |
Examples:
Code Block | ||
---|---|---|
| ||
gspt testbench measure-url --url https://greenspector.com/
gspt testbench measure-url --url https://greenspector.com/ --iterations 5 --browser chrome --networkMode 4G
gspt testbench measure-url --url https://www.mozilla.org/fr/ --browser firefox --report |
The options are :
1 - --url
: The URL to benchmark. Mandatory option
2 - --iterations
: Number of iterations of measure you want. (Default: 1). Optional
3 - --browser
: Browser you want to run the measure on. (Default: Google Chrome). Optional
4 - --networkMode: The network mode for the test. Values can be "WIFI", "4G", "3G" or "2G". (Default: WIFI). Optional
5 - --report
: Automatically generate the test report in the .greenspector
folder and wait for the job to end. (Default: false). Optional
This command will send a measure request to the server. After this measure has run on the Power Test Bench/Cloud, you will find the results on the web interface.
Benchmark one or more APK(s)
This feature allows you to benchmark your Android application on the Power Test Cloud/Bench.
To use this feature, you have to first configure the application name, version and the environment to run the measure on.
The command to run is:
Code Block | ||
---|---|---|
| ||
gspt testbench benchmark-apk --apkFile <path to APK> |
Examples:
Code Block | ||
---|---|---|
| ||
gspt testbench benchmark-apk --apkFile target/final.apk
gspt testbench benchmark-apk --apkFile target/main.apk --apkFile target/app-module.apk --apkFile target/commons.apk --networkMode 3G
gspt testbench benchmark-apk --apkFile target/final.apk --iterations 5 --report
gspt testbench benchmark-apk --apkFile target/final.apk --iterations 1 # apk from public url |
The options are and the environment to run the measure on.
The command to run is:
Code Block | ||
---|---|---|
| ||
gspt testbench benchmark-apk --app <path to APK> |
Examples:
Code Block | ||
---|---|---|
| ||
gspt testbench benchmark-apk --app target/final.apk # local path to apk
gspt testbench benchmark-apk --app https://demo/demo.apk # apk from public url
gspt testbench benchmark-apk --app com.microsoft.office.outlook # package name to download the apk from the PlayStore
gspt testbench benchmark-apk --app target/main.apk --apkFile target/app-module.apk --apkFile target/commons.apk --networkMode 3G # three apk to install and launch benchmark in 3G
gspt testbench benchmark-apk --app target/final.apk --iterations 5 --report # Launch 5 iterations of the benchmark and wait for the report
|
The options are :
1 - --app
: The APK(s) to benchmark. (If set multiple times, all the APK will be installed but only the first one will be launched and monitored). The apk file could be a local path, a public URL or a package name to download from the PlayStore. Optional if the applications to benchmark are already installed on phone
2 - --iterations
: Number of iterations of measure you want. (Default: 1). Optional
3 - --report
: (Beta feature) Automatically generate the test report in the .greenspector folder and wait for the job to end. (Default: false). Optional
4 - --networkMode: The network mode for the test. Values can be "WIFI", "4G", "3G" or "2G". (Default: WIFI). Optional
This command will send a measure request to the server. After this measure has run on the Power Test Bench/Cloud, you will find the results on the Web Interface.
Some options are deprecated:
1 - --apkFile
: The APK(s) to benchmark. (If set multiple times, all the APK will be installed but only the first one will be launched and monitored). The apk file could be a local path, a public URL or a package name to download from the PlayStore. Optional if the applications to benchmark are already installed on phonealready installed on phone. This option is deprecated, use --app.
2 - --iterations
: Number of iterations of measure you want. (Default: 1). Optional
3 - --report
: (Beta feature) Automatically generate the test report in the .greenspector folder and wait for the job to end. (Default: false). Optional
4 - --networkMode: The network mode for the test. Values can be "WIFI", "4G", "3G" or "2G". (Default: WIFI). Optional
This command will send a measure request to the server. After this measure has run on the Power Test Bench/Cloud, you will find the results on the Web Interface.
Some options are deprecated:
1 - --
apkFiles
: The APK(s) to benchmark. (If set multiple times, all the APK will be installed but only the first one will be monitored). Mandatory option: Minimum 1. This option is deprecated, use apkFile.
Run your custom functional tests on your APK / website
This feature allows you to run your custom functional tests on your Android application or web site on the Power Test Cloud/Bench.
To use this feature, you have to first configure the application name, version and the environment to run the measure on.
The command to run isapkFiles: The APK(s) to benchmark. (If set multiple times, all the APK will be installed but only the first one will be monitored). Mandatory option: Minimum 1. This option is deprecated, use --app.
Run your custom functional tests on your app / website
This feature allows you to run your custom functional tests on your Android application, iOS application or web site on the Power Test Cloud/Bench.
To use this feature, you have to first configure the application name, version and the environment to run the measure on.
The command to run is:
Code Block | ||
---|---|---|
| ||
# To run Greenspector DSL tests
gspt testbench custom-tests --app <APK or IPA to install> --testsSuite <suite name:path_testfile1.testgb,path_testfile2.testgb> --monitoredPackage <package to monitor>
# To run android tests (uiautomator, espresso)
gspt testbench custom-tests --app <path to APK to install> --app <path to APK test to install> --app <path to APK test to install> --testPackage <Test package to launch> --monitoredPackage <package to monitor> |
Examples:
Code Block | ||
---|---|---|
| ||
# To run android tests (uiautomator, espresso)
gspt testbench custom-tests --apkFile <path to APK> --testPackage <Test package to launch> --monitoredPackage <package to monitor>
or
# To run Greenspector DSL tests
gspt testbench custom-tests --apkFile <path to APK> --testsSuite <suite name:path_testfile1.testgb,path_testfile2.testgb> --monitoredPackage <package to monitor> |
Examples:
Code Block | ||
---|---|---|
| ||
run Greenspector DSL tests gspt testbench custom-tests --app target/demo.apk --testsSuite suite1:tests/file1.testgb --monitoredPackage com.greenspector.demo.app gspt testbench custom-tests --app target/demo.ipa --testsSuite suite1:tests/file1.testgb,tests/file2.tgb --testsSuite suite2:tests/file3.testgb --monitoredPackage com.greenspector.demo.app gspt testbench custom-tests --app fr.francetv.pluzz --testsSuite launch:./script.testgb --monitoredPackage fr.francetv.pluzz --iterations=1 # Other examples to run android tests without GDSL (uiautomator, espresso) gspt testbench custom-tests --app target/demo.apk --apkFileapp target/applicationtestuiautomator-debug-androidTest.apk --apkFileapp target/testtestuiautomator-debug.apk --testPackage com.greenspector.demo.tests --monitoredPackage com.greenspector.demo.app gspt testbench custom-tests --app https://dl.greenspector.com/demo/demo.apk --apkFile target/applicationapp https://dl.greenspector.com/demo/testuiautomator-debug-androidTest.apk --apkFile target/test-1.apkapp https://dl.greenspector.com/demo/testuiautomator-debug.apk --apkFile target/test-2.apktestPackage com.greenspector.demo.tests --testPackagemonitoredPackage com.greenspector.demo |
The options are:
1 - --app
: Precise the APP (android or iOS app) you want to measure. For android, if you do not have GDSL tests, you put the APKs which contain your functional tests
...
The options are:
1 - --apkFile
: Precise the APKs you want to measure and the APKs which contain your functional tests to launch. Prefer separate APKs for your app and for your tests.
2 - --testPackage
: For each APK containing functional tests you want to launch (i.e. UI Automator or Espresso tests), precise the name of the android package (i.e. package in file AndroidManifest.xml). All tests in those Android packages will be launched. Mandatory option: Minimum 1 if --testsSuite is not used
3 - --testsSuite
: For each suite, precise the suite name and the lists of test files writen with Greenspector DSL. All test files will be launched in the specified order. Mandatory option: Minimum 1 if --testPackage is not used
4 - --monitoredPackage
: For each Android application you want to monitored, precise the name of the android package to get metrics about the process (process data, process CPU…). Probes can monitor multi package at a time. In this case, metrics are agreggated. For website, choose the browser where the tests runs (i.e. com.android.chrome
). Mandatory option: Minimum 1
5 - --iterations
: Number of iterations of measure you want. (Default: 1). Optional
6 - --report
: Automatically generate the test report in the .greenspector folder and wait for the job to end.(Default: false). Optional
This command will send a measure request to the server. After this measure will ran on the Power Test Bench/Cloud, you will find the results on the Web Interface.
7 - --extra:
Use to transmit extras parameters to your instrumentation with the format name=value (ie --extra annotation=com.greenspector.demo.test.MyAnnotation add the following parameters to your instrumentation -e annotation com.greenspector.demo.test.MyAnnotation). Thus you can filter your tests for example using those extras parameters : https://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner). Optional
8 - --networkMode: The network mode for the test. Values can be "WIFI", "4G", "3G" or "2G". (Default: WIFI). Optional
Some options are deprecated:to launch. Prefer separate APKs for your app and for your tests. The app could be a local file path to an ipa or an apk, a public URL to a ipa or apk or a package name to download from the PlayStore, or an url to install ipa from Apple store
2 - --testPackage
: For each APK containing functional tests you want to launch (i.e. UI Automator or Espresso tests), precise the name of the android package (i.e. package in file AndroidManifest.xml). All tests in those Android packages will be launched. Only for non GDSL test. Mandatory option: Minimum 1 if --testsSuite is not used
3 - --testsSuite
: For each suite, precise the suite name and the lists of test files writen with Greenspector DSL. All test files will be launched in the specified order. Mandatory option: Minimum 1 if --testPackage is not used
4 - --monitoredPackage
: For each Android application you want to monitored, precise the name of the android package to get metrics about the process (process data, process CPU…). Probes can monitor multi package at a time. In this case, metrics are agreggated. For website, choose the browser where the tests runs (i.e. com.android.chrome
). Mandatory option: Minimum 1
5 - --iterations
: Number of iterations of measure you want. (Default: 1). Optional
6 - --report
: Automatically generate the test report in the .greenspector folder and wait for the job to end.(Default: false). Optional
This command will send a measure request to the server. After this measure will ran on the Power Test Bench/Cloud, you will find the results on the Web Interface.
7 - --extra:
Use to transmit extras parameters to your instrumentation with the format name=value (ie --extra annotation=com.greenspector.demo.test.MyAnnotation add the following parameters to your instrumentation -e annotation com.greenspector.demo.test.MyAnnotation). Thus you can filter your tests for example using those extras parameters : https://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner). It can also be used to fill parameters on GDSL file. (exemple --extra PARAMETERNAME="value" will replace all ${PARAMETERNAME} in the GDSL file by value). Optional
8 - --networkMode: The network mode for the test. Values can be "WIFI", "4G", "3G" or "2G". (Default: WIFI). Optional
9 - --
disable-dumpsys: Disable Android System Monitoring. By default, this is enabled and will add one iteration to your job for more detailed metrics (Views, Activity, OpenSSL Sockets, ...). If you don't need these metrics, you can disable this iteration, it will reduce testing time.
10 - --
only-dumpsys: Run only a Android System Monitoring iteration. This iteration will only be able to retrieve Android System metrics (Views, Activity, OpenSSL Sockets, ...).
Some options are deprecated:
1 - --apkFile
: Precise the APKs you want to measure and the APKs which contain your functional tests to launch. Prefer separate APKs for your app and for your tests. The apk file could be a local path, a public URL or a package name to download from the PlayStore. This option is deprecated, use --app
1 - --apkFiles
: Precise the APKs you want to measure and the APKs which contain your functional tests to launch. Prefer separate APKs for your app and for your tests. This option is deprecated,
use apkFile
use --app
2 - --testPackages
: For each APK containing functional tests you want to launch (i.e. UIAutomator or Espresso tests), precise the name of the android package (i.e. package in file AndroidManifest.xml). All tests in those Android packages will be launched. This option is deprecated,
use use --testPackage
3 - --monitoredPackages
: The package name of the Android application to monitor with the probes to get metrics about the process (process data, process CPU…). Probes can monitor only one package at a time. For website, choose the browser where the tests runs (i.e. com.android.chrome
). This option is deprecated, use monitoredPackages
use --monitoredPackage
Related articles
Filter by label (Content by label) | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|