The testrunner needs job and config files to execute tests. They can be found in the Modules/Testrunner/Templates section on Greenspector App.
Style rules :
Bold : parameters which contain a value
Italic : not free choice of value (ex: false/true)
1 - Job.yml
The job.yml will give the instructions to the testrunner about the journey details (variables, iterations
Here, there is the file template for ios test available on Modules section/Testrunner/Job for iOS in Greenspector App.
Different code lines are explained below.
mode: custom greenspector: application: name: ${APP_NAME} # Your application's name version: ${APP_VERSION} # Your application's version
mode:
custom: test with a gdsl script
app: benchmark from an APK (ex: com.google.ios.youtube)
url: benchmark from an URL (ex: https://metropole.nantes.fr)
greenspector/application
name : the name of the application of Greenspector App
version : the name of the version
job: # List all mandatory apk to install on the phone before the launch of the test # URL can be package name to install from Playstore, local path on an apk or public URL to an apk # urls: # - ${URL} testsSuites: - name: suite1 testFiles: - "./script.testgb" monitoredPackages: - ${MONITORED_PACKAGE} # The package to monitor, existing or newly installed iterations: 1 # Number of iteration for each test case extras: config-screenbrightness: "127" config-skipsetupphone: "true" PAUSEDURATION: "${PAUSEDURATION}" PAUSEAFTERLOAD: "${PAUSEAFTERLOAD}" testTimeout: 30m0s # Timeout for the total duration of the test, default value is 30m, max value is 60m online: true # [true, false] networkMode: WIFI modules: hardware_probe: false tcpdump: false
testsSuites
name: the name of the application
testFiles: the path of the functional journey file
monitoredPackages: app package
→ With ios, this field is only use for benchmark APK to open the app
iterations: Number of iteration for each test case
extras :
PAUSEDURATION
PAUSEAFTERLOAD
→ With ios, the extras field is only use for variables
testTimeout: Timeout for the total duration of the test, default value is 30m, max value is 60m
online:
false : results available on your PC
true : results available on Greenspector App and locally
→ With ios, the networkMode field is not used
modules
hardware_probe: “false” (use of the hardware module to get the energy consumption)
tcpdump: “false” (use of the tcpdump module to get the exchanged data)
Extras can be added:
PAUSEAFTERACTION: 500
PAUSEAFTERSCROLL: 500
Variables needed (id, password, ..)
Example
# Testrunner job configuration file mode: custom greenspector: application: name: LeMonde version: "automatisation" job: # Custom job android apk testsSuites: - name: "LeMonde" testFiles: - ios.testgb iterations: 1 testTimeout: 60m0s online: false modules: hardware_probe: false tcpdump: false extras: PAUSEDURATION: 2000 PAUSEAFTERLOAD : 1000 PAUSEAFTERACTION: 500 PAUSEAFTERSCROLL: 500 ID: jean PSWD: 5678
2 - Config.yml
The config.yml will give the information to the testrunner about the device and the server connection.
Here, there is the file template for ios test available on Modules section/Testrunner/Config for iOS in Greenspector App.
Different code lines are explained below.
platform: ios # The platform you are testing on [mobile | pc] resultPath: ./greenspector # The path where you want the Testrunner to save the tests results. defaults to ./greenspector/measures target: # target bloc for iOS mode ip: ${PHONE_IP} udid: ${PHONE_UDID} name: ${PHONE_NAME} lang: ${PHONE_LANGUAGE} paths: webDriverAgent: /usr/local/lib/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj # Full path to WebDriverAgent xcodeproject ios-deploy: /usr/local/bin/ios-deploy # Path to ios-deploy. Leave this empty if ios-deploy is in your PATH greenspector: server: ${GREENSPECTOR_CORE_SERVER_URL} # URL of your Greenspector instance token: ${PRIVATE_TOKEN} # Your private token registered on Greenspectors
plateform: The platform you are testing on (ios)
resultPath: The path where the Testrunner saves the tests results. defaults to ./greenspector/measures
ip: IP address of the iPhone
udid: Unique Device ID of the iPhone (you can find it on Xcode > Window > Devices and Simulators)
name: Name of the iPhone (you can find it on Xcode > Window > Devices and Simulators)
lang: “en” for english, “fr” for french
paths
webDriverAgent: Full path to WebDriverAgent xcodeproject
ios-deploy: Path to ios-deploy. Leave this empty if ios-deploy is in your PATH
greenspector/server: URL of Greenspector instance (https://app.greenspector.com)
greenspector/token: Private token registered on Greenspector in Profile/Preferences
Parameters can be added:
log-level: The log level you want (from maximum to minimum log)
debug
info
warn
error
fatal
panic
Target parameters can be added:
target: # For the hardware_probe module in the job.yml file hardware: address: /dev/ttyACM0 # For the tcpdump module in the job.yml file tcpdump: gatewayIP: 10.42.0.1 # IP of the gateway used to filter data networkInterface: wlp2s0 # Network interface used to detect data (wlp2s0...) keepPcap: false # If true, it keeps the pcap file at the end of the measures ipFilters: # Other IP addresses used to filter data apple: false # If true, it filters data related with 17.0.0.0/8 launchOnDevice: false # If true, it launches tcpdump on the device
For more information on the tcpdump module, see: Collect of data via network probe
Example
log-level: debug platform: ios resultPath: ./results target: ip: 192.168.2.4 udid: 00008110-001969180AA8201E name: "iPhone" lang: fr paths: webDriverAgent: /opt/homebrew/lib/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj ios-deploy: /usr/local/bin/ios-deploy hardware: address: /dev/cu.usbmodem11401 tcpdump: gatewayIP: 192.168.2.1 networkInterface: bridge100 ipFilters: apple: true greenspector: server: https://app.greenspector.com token: ******************************
Indentation is important in these files, please be aware.