/
Launch local tests (Android)

Launch local tests (Android)

update 25 nov 2024

In this section, you will find how to launch a functional journey analysis on a local android device as it has been described in the Getting started part.

Preparation

Settings

In the display options :

  • Configure brightness adaptation in manual mode

  • Set phone sleep timer to maximum

In the language settings :

  • If possible, set the language to 'English - United Kingdom

[Optional] Create an application on the Greenspector App

If it is not done and you want to save measures on the web interface, create an application on Greenspector Studio

  • Go to the Applications menu

  • Click on New Analysis

  • Enter needed information

  • Validate

 

Complete files

To launch tests, the testrunner executable needs config and job files. For more information about the content of these files, check the section Complementary files (Android) .

You will need some information to launch functional journey analysis on local device :

Modification of config.yml file

Edit the config.yml file you have just downloaded, replace :

  • ${PHONE_IP} by your phone's IP address

  • ${PHONE_PORT} by 5555

  • ${PATH_TO_ADB} by the path to the adb executable. Simply write "adb" if this command is already in your environment variables.

  • ${PATH_TO_AAPT} by the path of the aapt executable. Simply write "aapt" if this command is already in your environment variables.

  • ${GREENSPECTOR_CORE_SERVER_URL} by https://core-saas-prod.greenspector.com

  • ${PRIVATE_TOKEN} by your token. To find your token, go to the Greenspector interface, click on your name in the top right-hand corner, then click on the "Preferences" tab.

Modification of job.yml file

Edit the job.yml file you have just downloaded, replace :

  • ${APP_NAME} by the name of your application.

  • ${APP_VERSION} by the tested version (date, app version, other).

  • In the testFiles field, enter the path to your test scenario

  • ${MONITORED_PACKAGE} by the name of your application package. If you are measuring on a website, write "com.android.chrome".

  • ${PAUSEDURATION} by 1000 (1000 ms, i.e. 1 second)

  • ${PAUSEAFTERLOAD} by 1000 (1000 ms, i.e. 1 second)

 

Launch a functional journey analysis on a local android device

Launch of a functional journey on a local device needs :

  • GDSL script

  • job.yml & config.yml

  • Connected smartphone in adb

 

Reminders:

Enable USB debug

To launch measurements on tests in local mode, the Greenspector testrunner needs to establish a ADB (Android Debug Bridge) connection with the local device. An access to Android developer options is needed:

  • Go to the Android device settings

  • Go to About phone > Software information section

  • Tap 7 times on section Build Number. A pop-up confirms activation.

  • Go back to Settings / Developer options

  • Activate USB debugging option

The procedure can vary widely from a device to another. Please follow the official Android tutorial for more informations. Configure on-device developer options.

Connect device to computer

  • Plug the device to a computer via an USB cable

  • Run the following commands to verify USB connection:

adb kill-server adb devices
  • The device should be detected. A pop-up Allow USB debugging? should appear on device. Click on Allow:

USB debugging pop-up

Activate ADB Wifi

  • Connect your device through USB

  • Verify ADB connection :

adb kill-server adb devices
  • The device should be detected. If it’s the first connection, a pop-up Allow USB debugging? should appear on device. Click on Allow:

  • Run the following command to enable network connection:

adb tcpip 5555
  • Disconnect USB cable from your device

  • Run the following command to establish network connection:

  • Run the following command to verify network connection:

You should see your device now identified with its IP.

Test launch

Testrunner is now ready to be launched. Simply launch it to start a test:

  • Go in the folder where job and config files are located

  • Launch the following command in the terminal

  • During the test execution and until test end:

    • Don’t close terminal

    • Don’t interact with device. Check device screen to see the test running.

Results

The Testrunner prompts the result at the end of the test. In case of failure, error’s line is given to help to adapt GDSL file. Results are available:

  • In your working directory with greenspector/dd-mm-yyyy XXhXXm/tests-results/results.txt

  • On Greenspector Studio if online is true in job.yml.

For a better understanding, screenshots of steps are available at greenspector/dd-mm-yyyy XXhXXm/tests-results/MYAPP/parcours/iteration 1/screenshots. The final state is called success.png or failed.png regarding the result.

 

Version change

It is possible to change version of results of measure as many times as needed. It can be a date, a new version of the application or website, a different journey, a functionality test, different test conditions, etc.

Change in job.yml :

  • ${APP_VERSION} by the tested version.

If you registered measures are stored online on Greenspector Studio by online=true in job.yml, versions, versions are visible in the Meter tab.