Launch tests on emulator

You can use an android emulator to help you develop your GDSL tests. It is useful if you do not have a real device or if you want to test on a device with the same resolution as a device on the Test Bench. Do not use emulator if you want measures, the metrics (energy, data …) are not available.


1 - Change the job.yml file

job: extras: config-skipsetupphone: true

 

To be able to run an application with the applicationStart gdsl function, there are 2 choices :

  • Install the app manually through the Play Store application

  • In the job.yml file, add an url field with the name of the application package. Example :

job: url: com.android.chrome

In the second case, it installs the app at the beginning of the test and uninstalls it at the end.

 

2 - Change the config.yml file

target: connection: usb serial: xxxx

The target.serial field corresponds to the emulator id. You can find it by running “adb devices”.

 

3 - Run the testrunner

  • Launch an android emulator

    • Option 1: open the Device Manager window of Android Studio and click on the triangle

    • Option 2: start an emulator from the command line (part 2.5)

  • If you run the testrunner for the first time, you have to run it once without the --no-update option:

    • On Linux and macOS: ./testrunner -jobFile job.yml -config config.yml

    • On Windows: testrunner -jobFile job.yml -config config.yml

On macOS with M1 chip, you may need to install Rosetta first:

/usr/sbin/softwareupdate --install-rosetta --agree-to-license

On macOS with M1 chip, you have to download the android-service executable with arm architecture: https://dl.greenspector.com/emulator/android-service-files-mac-m1.tar.gz

  • Go to your greenspector cache:

    • On Linux and macOS: $HOME/.greenspector

    • On Windows: C:\Users\[username]\.greenspector

  • Replace the android-service and android-service.version files with the downloaded files. You will have to decompress the tar.gz file.

  • You can now run the testrunner with the --no-update option:

    • On Linux and macOS: ./testrunner -jobFile job.yml -config config.yml --no-update

    • On Windows: testrunner -jobFile job.yml -config config.yml --no-update

 

If you forget the --no-update option, you have to replace the android-service and android-service.version files again.