• Home
Name Date Size #Lines LOC

..--

gradle/wrapper/03-May-2024-76

src/03-May-2024-4,4323,246

.gitignoreD03-May-2024110 1110

Android.bpD03-May-20241.3 KiB4744

CONTRIBUTING.mdD03-May-20241 KiB2618

LICENSED03-May-202411.1 KiB203169

METADATAD03-May-2024564 2018

MODULE_LICENSE_APACHE2D03-May-20240

OWNERSD03-May-2024202 119

README.mdD03-May-20242.2 KiB7048

build.gradleD03-May-20243 KiB11296

gradle.propertiesD03-May-2024115 54

gradlewD03-May-20244.9 KiB161120

README.md

1Mobly Bundled Snippets is a set of Snippets to allow Mobly tests to control
2Android devices by exposing a simplified version of the public Android API
3suitable for testing.
4
5We are adding more APIs as we go. If you have specific needs for certain groups
6of APIs, feel free to file a request in [Issues](https://github.com/google/mobly-bundled-snippets/issues).
7
8Note: this is not an official Google product.
9
10
11## Usage
12
131.  Compile and install the bundled snippets
14
15        ./gradlew assembleDebug
16        adb install -d -r -g ./build/outputs/apk/debug/mobly-bundled-snippets-debug.apk
17
181.  Use the Mobly snippet shell to interact with the bundled snippets
19
20        snippet_shell.py com.google.android.mobly.snippet.bundled
21        >>> print(s.help())
22        Known methods:
23          bluetoothDisable() returns void  // Disable bluetooth with a 30s timeout.
24        ...
25          wifiDisable() returns void  // Turns off Wi-Fi with a 30s timeout.
26          wifiEnable() returns void  // Turns on Wi-Fi with a 30s timeout.
27        ...
28
291.  To use these snippets within Mobly tests, load it on your AndroidDevice objects
30    after registering android_device module:
31
32    ```python
33    def setup_class(self):
34      self.ad = self.register_controllers(android_device, min_number=1)[0]
35      self.ad.load_snippet('api', 'com.google.android.mobly.snippet.bundled')
36
37    def test_enable_wifi(self):
38      self.ad.api.wifiEnable()
39    ```
40
41## Develop
42
43If you want to contribute, use the usual github method of forking and sending
44a pull request.
45
46Before sending a pull request, run the `presubmit` target to format and run
47lint over the code. Fix any issues it indicates. When complete, send the pull
48request.
49
50```shell
51./gradlew presubmit
52```
53
54This target will reformat the code with
55[googleJavaFormat](https://github.com/sherter/google-java-format-gradle-plugin)
56and run lint. The lint report should open in your default browser.
57
58Be sure to address *all* off the errors reported by lint. When finished and you
59run `presubmit` one last time you should see:
60
61> No Issues Found
62>   Congratulations!
63
64in your browser.
65
66## Other resources
67
68  * [Mobly multi-device test framework](http://github.com/google/mobly)
69  * [Mobly Snippet Lib](http://github.com/google/mobly-snippet-lib)
70