tag | 54214ce94db1335069c166e471fd8a3433ea46f2 | |
---|---|---|
tagger | The Android Open Source Project <initial-contribution@android.com> | Wed Apr 24 20:11:00 2024 -0700 |
object | f0fb0368172b2cac860fbd25ab3213841cab84bb |
aml_wif_341610000 (11391728,com.google.android.wifi)
commit | f0fb0368172b2cac860fbd25ab3213841cab84bb | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Fri Jul 07 01:01:20 2023 +0000 |
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Fri Jul 07 01:01:20 2023 +0000 |
tree | b9ba7847f42e87d5f75664f149ab3713c0e89267 | |
parent | 119b666eae32a820b476d05bbf7ff440ae6ed5dc [diff] | |
parent | 8741c11d0fb406f000e818c860720f092e03a5f3 [diff] |
Snap for 10447354 from 8741c11d0fb406f000e818c860720f092e03a5f3 to mainline-wifi-release Change-Id: I0db8323e87035f9af60732c0d86dbe12fac093f7
Mobly Snippet Lib is a library for triggering device-side code from host-side Mobly tests. This tutorial teaches you how to use the snippet lib to trigger custom device-side actions.
Note: Mobly and the snippet lib are not official Google products.
The Mobly Snippet Lib allows you to write Java methods that run on Android devices, and trigger the methods from inside a Mobly test case. The Java methods invoked this way are called snippets
.
The snippet
code can either be written in its own standalone apk, or as a product flavor of an existing apk. This allows you to write snippets that instrument or automate another app.
A snippet is launched by an am instrument
call. Snippets use a custom InstrumentationTestRunner
derived from AndroidJUnitRunner
. This allows for snippets that interact with a main app's classes, such as Espresso snippets, and allows you to get either the test app's or the main app's context from InstrumentationRegistry
.
Once started, the special runner starts a web server which listens for requests to trigger snippets. The server's handler locates the corresponding methods by reflection, runs them, and returns results over the TCP socket. All common built-in variable types are supported as arguments.
The examples/ folder contains examples of how to use the mobly snippet lib along with detailed tutorials.