Testing Android Changes in the Devicelab on an Emulator
While the Devicelab is typically for testing on Devices we have added support so that developers can now test Android changes via the LUCI recipes on an Android Emulator.
You can specify a new test via the .ci.yaml file in the repository. This allows the infra framework to run the test automatically with minimal work from the developer.
Adding a new Devicelab Android Emulator test for Android feature changes requires the following steps:
Starting with the finished target yaml definition:
- name: Linux_android android_defines_test
recipe: devicelab/devicelab_drone
presubmit: true
timeout: 60
dimensions: {
kvm: “1”,
cores: “8”,
Machine_name: “n1-standard-8”
}
properties:
device_type: “none”
task_name: android_defines_test
use_emulator: “true”
dependencies: >-
[
{"dependency": "android_virtual_device", "version": "31"}
]
tags: >
["devicelab", “linux”]
timeout: 300
-
The
name
of the target consists of the platform which can be eitherLinux
orLinux_Android
. It is better to pickLinux_Android
since it will provide you more of the needed dependencies. -
The
recipe
is alwaysdevicelab/devicelab_drone
. This is the recipe that will launch the emulator and drive the test. -
presubmit
can betrue
orfalse
. To run the test in any PR that is opened you should set this totrue
. This is the best approach to catch bugs before they are mirrored to google3. -
timeout
is an integer value. -
dimensions
is needed to tell the LUCI framework that we need to run this test on a machine that supports nested virtualization and should be set as shown. -
properties
:a.
device_type
must be set tonone
so that we use a machine without an attached android phone. This will cause problems if not set.b.
task_name
is the name to apply to the task.c.
use_emulator
is the flag to tell the test recipe that we need to create an Emulator for this test.d.
dependencies
can be used to override theandroid_virtual_device
api version.e.
tags
should be set todevicelab
andlinux
f.
timeout
the timeout here is for the time to give the test to run before killing it.
If you want to update an existing target you will only need to add the following changes:
- add a
dimensions
field as described above. - Set the
device_type: "none"
. - Add
use_emulator: "true"
flag in properties. Note this is not a boolean but must be a string. - Add a dependency for the android emulator version to the properties. If there are no dependencies add it as shown above.
- Remove any tags that specify android. These are for benchmark tests and having them in will cause some of the device checks to fail.
- Home of the Wiki
- Roadmap
- API Reference (stable)
- API Reference (main)
- Glossary
- Contributor Guide
- Chat on Discord
- Design documents
- Code of Conduct
- Issue triage reports (latest)
- Our Values
- Tree hygiene
- Issue hygiene and Triage
- Style guide for Flutter repo
- Project teams
- Contributor access
- What should I work on?
- Popular issues
- Running and writing tests
- Release process
- Flutter Framework Gardener Rotation
- Rolling Dart
- Manual Engine Roll with Breaking Commits
- Updating Material Design Fonts & Icons
- Postmortems and Retrospectives
- Hotfix Documentation Best Practices
- In case of emergency
- Landing Changes With Autosubmit
- Setting up the Framework development environment
- The Framework architecture
- API Docs code block generation
- Running examples
- Using the Dart analyzer
- The flutter run variants
- Test coverage for package:flutter
- Writing a golden-file test for package:flutter
- Managing template image assets
- Setting up the Engine development environment
- Compiling the engine
- Debugging the engine
- Using Sanitizers with the Flutter Engine
- Testing the engine
- The Engine architecture
- Flutter's modes
- Crashes
- more...
- Setting up the Packages development environment
- Plugins and Packages repository structure
- Contributing to Plugins and Packages
- Understanding Packages tests
- Plugin Tests
- Releasing a Plugin or Package
- more...