Table of Contents |
---|
You can use an android emulator to help you develop your GDSL tests. It is usefull 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.
...
Follow the first part of the prerequisite (part 1.1)
Install Android SDK Tools:
Install Android Studio if you don’t have it
Open Android Studio
Click on More Actions > SDK Manager (or Tools > SDK Manager if a project is open)
Click on the SDK Tools tab, uncheck "Hide Obsolete Packages"
Check Android SDK Tools and install version 26.1.1
Add ADB (Android Debug Bridge) to your environment variables:
On Linux: add the line
export PATH=$HOME/Android/Sdk/platform-tools:$PATH
in the .bashrc file and run the command "source ~/.bashrc"On Mac: add the line
export PATH=$HOME/Library/Android/sdk/platform-tools:$PATH
in the .bash_profile file and run the command "source ~/.bash_profile"On Windows: Windows start menu > Settings > System > About > Advanced settings > Environment variables > Path > Modify > Add the path
C:\Users\[username]\AppData\Local\Android\Sdk\platform-tools
. Replace username by the name of the user.
Add AAPT (Android Asset Packaging Tool) to your environment variables:
On Linux: add the line
export PATH=$HOME/Android/Sdk/build-tools/[aapt_folder]:$PATH
in the .bashrc file and run the command "source ~/.bashrc". Replace aapt_folder by the name of the aapt folder.On Mac: add the line
export PATH=$HOME/Library/Android/sdk/build-tools/[aapt_folder]:$PATH
in the .bash_profile file and run the command "source ~/.bash_profile". Replace aapt_folder by the name of the aapt folder.On Windows: Windows start menu > Settings > System > About > Advanced settings > Environment variables > Path > Modify > Add the path
C:\Users\[username]\AppData\Local\Android\Sdk\build-tools/\[aapt_folder]
. Replace username by the name of the user and aapt_folder by the name of the aapt folder.
Get the testrunner from https://app.greenspector.com/ in the Modules tab, and put it in a folder (for example “testrunner_files”)
Add in this folder the configuration files config.yml and job.yml, and a script with the testgb extension. An example of these files is available at the following location:
configuration files: https://app.greenspector.com/download > Test Runner: Download > “Config - Android” and “Job - Android”
testgb file: https://app.greenspector.com/download > GDSL Templates: Download (you can choose between a test file for an Android application, a website, or an iOS application)
...
Android GDSL functions: https://dsl.greenspector.com/
How to use uiautomatorviewer to get elements of a view (by id, text, class or description) to write GDSL test: How to get Get elements of a view (by id, text, class or description) to write GDSL test (AndroidUIAutomatorViewer)
2. Use an android emulator without Greenspector tools
...
Open the configuration file of your emulator. Replace [device_id] by the id of your device.
On Linux and macOS:
$HOME/.android/avd/[device_id]/config.ini
On Windows:
C:\Users\[username]\.android\avd\[device_id]\config.ini
Make the following changes:
PlayStore.enabled: change from “false” to “true”
image.sysdir.1: change “google_apis” to “google_apis_playstore”
tag.display: change “Google APIs” to “Google Play”
tag.id: change “google_apis” to “google_apis_playstore”
Save your changes
On the Device Manager window, select the three dots button and click on “Wipe Data”. It will load the new configuration.
We expect the following error message:
...
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
Info |
---|
On macOS with M1 chip, you may need to install Rosetta first:
|
...
have the following warning:
To fix that accept the notification by clicking on Allow anyway in the Apple menu / System Settings > Privacy & Security |
Info |
---|
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
...
may need to install Rosetta first:
|