Bug: 210867144

Clone this repo:
  1. 5b05d3e Build mobly-bundled-snippets as APK instead of android_library by Xianyuan Jia · 6 weeks ago master
  2. 8277d98 Switch to source-built GSON. by Krzysztof Kosiński · 3 months ago
  3. e5cb1d2 Revert^2 "Set build rules for mobly bundled libs" am: 09edf69479 am: e5ab2b5b6c am: 011003be7d am: 2b7ac2f460 by Julien Desprez · 11 months ago android13-dev android13-frc-adbd-release android13-frc-art-release android13-frc-cellbroadcast-release android13-frc-conscrypt-release android13-frc-documentsui-release android13-frc-extservices-release android13-frc-ipsec-release android13-frc-media-release android13-frc-media-swcodec-release android13-frc-networking-release android13-frc-neuralnetworks-release android13-frc-os-statsd-release android13-frc-permission-release android13-frc-resolv-release android13-frc-scheduling-release android13-mainline-adbd-release android13-mainline-adservices-release android13-mainline-appsearch-release android13-mainline-art-release android13-mainline-cellbroadcast-release android13-mainline-conscrypt-release android13-mainline-extservices-release android13-mainline-go-adbd-release android13-mainline-go-adservices-release android13-mainline-go-appsearch-release android13-mainline-go-art-release android13-mainline-go-cellbroadcast-release android13-mainline-go-conscrypt-release android13-mainline-go-documentsui-release android13-mainline-go-extservices-release android13-mainline-go-ipsec-release android13-mainline-go-media-release android13-mainline-go-media-swcodec-release android13-mainline-go-mediaprovider-release android13-mainline-go-networking-release android13-mainline-go-neuralnetworks-release android13-mainline-go-odp-release android13-mainline-go-os-statsd-release android13-mainline-go-permission-release android13-mainline-go-resolv-release android13-mainline-go-scheduling-release android13-mainline-go-sdkext-release android13-mainline-go-tethering-release android13-mainline-go-tzdata4-release android13-mainline-go-uwb-release android13-mainline-go-wifi-release android13-mainline-ipsec-release android13-mainline-media-release android13-mainline-media-swcodec-release android13-mainline-mediaprovider-release android13-mainline-networking-release android13-mainline-os-statsd-release android13-mainline-permission-release android13-mainline-resolv-release android13-mainline-sdkext-release android13-mainline-tethering-release android13-mainline-tzdata4-release android13-mainline-uwb-release android13-mainline-wifi-release aml_adb_331011040 aml_adb_331011050 aml_ads_331131000 aml_art_331012050 aml_ase_331011020 aml_cbr_330810000 aml_cbr_330911010 aml_cbr_331013010 aml_con_331011010 aml_ext_331012020 aml_go_adb_330913000 aml_go_ads_330913000 aml_go_art_330913000 aml_go_ase_330913000 aml_go_cbr_330912000 aml_go_con_330913000 aml_go_doc_330912000 aml_go_ext_330912000 aml_go_ips_330911000 aml_go_med_330913000 aml_go_mpr_330912000 aml_go_net_330913000 aml_go_neu_330912000 aml_go_odp_330912000 aml_go_per_330912000 aml_go_res_330912000 aml_go_sch_330911000 aml_go_sdk_330810000 aml_go_sta_330911000 aml_go_swc_330913000 aml_go_tet_330914010 aml_go_tz4_330912000 aml_go_uwb_330912000 aml_go_wif_330911000 aml_ips_331014020 aml_med_331012020 aml_mpr_330811020 aml_mpr_330911040 aml_mpr_331011070 aml_net_330811010 aml_net_330910010 aml_net_331011030 aml_per_330811030 aml_per_330912010 aml_per_331019040 aml_res_330810000 aml_res_330910000 aml_res_331011050 aml_sdk_330810010 aml_sdk_330810050 aml_sta_330910000 aml_sta_331010010 aml_swc_331012020 aml_tet_330812150 aml_tet_330911010 aml_tet_331012080 aml_tz4_331012000 aml_tz4_331012040 aml_tz4_331012050 aml_uwb_330810010 aml_uwb_331015040 aml_wif_330810040 aml_wif_330910030 aml_wif_331016070 t_frc_adb_330444000 t_frc_art_330443060 t_frc_ase_330444010 t_frc_cbr_330443000 t_frc_con_330443020 t_frc_doc_330443000 t_frc_doc_330443060 t_frc_ext_330443000 t_frc_ips_330443010 t_frc_med_330443030 t_frc_net_330443000 t_frc_neu_330443000 t_frc_neu_330443030 t_frc_per_330444010 t_frc_res_330443000 t_frc_sch_330443010 t_frc_sch_330443040 t_frc_sta_330443010 t_frc_swc_330443010 t_frc_swc_330443040 t_frc_tz4_330443010
  4. 2b7ac2f Revert^2 "Set build rules for mobly bundled libs" am: 09edf69479 am: e5ab2b5b6c am: 011003be7d by Julien Desprez · 11 months ago
  5. 011003b Revert^2 "Set build rules for mobly bundled libs" am: 09edf69479 am: e5ab2b5b6c by Julien Desprez · 11 months ago

Mobly Bundled Snippets is a set of Snippets to allow Mobly tests to control Android devices by exposing a simplified version of the public Android API suitable for testing.

We are adding more APIs as we go. If you have specific needs for certain groups of APIs, feel free to file a request in Issues.

Note: this is not an official Google product.

Usage

  1. Compile and install the bundled snippets

    ./gradlew assembleDebug
    adb install -d -r -g ./build/outputs/apk/debug/mobly-bundled-snippets-debug.apk
    
  2. Use the Mobly snippet shell to interact with the bundled snippets

    snippet_shell.py com.google.android.mobly.snippet.bundled
    >>> print(s.help())
    Known methods:
      bluetoothDisable() returns void  // Disable bluetooth with a 30s timeout.
    ...
      wifiDisable() returns void  // Turns off Wi-Fi with a 30s timeout.
      wifiEnable() returns void  // Turns on Wi-Fi with a 30s timeout.
    ...
    
  3. To use these snippets within Mobly tests, load it on your AndroidDevice objects after registering android_device module:

    def setup_class(self):
      self.ad = self.register_controllers(android_device, min_number=1)[0]
      self.ad.load_snippet('api', 'com.google.android.mobly.snippet.bundled')
    
    def test_enable_wifi(self):
      self.ad.api.wifiEnable()
    

Develop

If you want to contribute, use the usual github method of forking and sending a pull request.

Before sending a pull request, run the presubmit target to format and run lint over the code. Fix any issues it indicates. When complete, send the pull request.

./gradlew presubmit

This target will reformat the code with googleJavaFormat and run lint. The lint report should open in your default browser.

Be sure to address all off the errors reported by lint. When finished and you run presubmit one last time you should see:

No Issues Found Congratulations!

in your browser.

Other resources