Status | ||||
---|---|---|---|---|
|
You can use Jenkins to launch your GREENSPECTOR Tests to measure your website or your mobile app.
Requirements
You need to install the GREENSPECTOR the GREENSPECTOR CLI on your Jenkins server
- The GREENSPECTOR CLI file could be downloaded from the Modules page of your GREENSPECTOR Web Interface. You have to choose the executable which match your server OS.
- Connect to your Jenkins server through ssh or ftp
- Upload the GREENSPECTOR CLI on your Jenkins server and Slaves if any
- Prefer to rename the file in gspt
- For linux or mac environment, you need to give right of execution : chmod +x gspt
- Prefer to put it in your path
...
You have to use the GREENSPECTOR CLI commands to configure the measure to launch. If you need more detail on GREENSPETOR click on GREENSPECTOR CLI .
In the 'Execute shell' block, you have to do :
- Set your GREENSPECTOR instance and token. Use the secret you have previously configured.
Code Block gspt init -a https://app.greenspector.com/api -p $MY_GREENSPECTOR_PRIVATE_TOKEN
- Set the GREENSPECTOR application and version in which you want to send measures. We set, for the version, the date of the day but you can use any build number of your application.
Code Block gspt initprojectconfiguration --application "greenspector.com" --version "$(date '+%d-%m-%Y')"
Set the device on which the measures will be launched. For example a Galaxy S7.
Code Block gspt testbench set-environment --environment "mobile::android::8::Samsung - Galaxy S7"
To have a list of all available devices on which you can send measures, you can use the GREENSPECTOR CLI on your PC for example :
The command 'gspt testbench set-environment ' gives gthe the list
Then you have to replace the android version and the device name in the previous command. For example to send measure on Galaxy S9 android 10 ,
...
Code Block |
---|
# launch 3 iterations of a benchmark on the site web
gspt --spinnerOff testbench measure-url --iterations 3 --url https://greenspector.com/fr/accueil/ |
...
If your application is already installed on the phone or is available on PlayStore, you need to precise the package name. For example, with this we launch 3 iterations on the application Netflix.
Code Block |
---|
gspt --spinnerOff testbench benchmark-apk --targetapkFile "com.netflix.mediaclient" --iterations 3 |
...
In other case, you need to pass an apk via a public url or an url accessible by your jenkins
Code Block |
---|
gspt --spinnerOff testbench benchmark-apk --targetapkFile https://dl.greenspector.com/demo/demo.apk --iterations 3 |
...
Or to pass an apk via an absolute PATH in JENKINS or relative PATH in your freestyle project
Code Block |
---|
gspt --spinnerOff testbench benchmark-apk --targetapkFile ./demo.apk --iterations 3 |
...
Code Block |
---|
# Path to your GDSL script in the working directory
PWD=$(pwd)
TEST_SUITE1="$PWD/greenspector-site.testgb"
# launch a custom test with your gdsl script
gspt --spinnerOff testbench custom-tests --monitoredPackage com.android.chrome --iterations 3 --testsSuite "suite1:$TEST_SUITE1" --networkMode WIFI |
- To write GDSL Test, you can consult read Greenspector DSL for Android
- You should set the monitoredPackage argument.
...
If the test launch is a benchmark, you can go to the 'Dashboard' tab :
You can consult view all the measures :
You can consult view the evolution of for each version :