1*cf78ab8cSAndroid Build Coastguard Worker# Example Mobly Test 2*cf78ab8cSAndroid Build Coastguard Worker 3*cf78ab8cSAndroid Build Coastguard WorkerThis direcotry contains example Mobly tests. 4*cf78ab8cSAndroid Build Coastguard Worker 5*cf78ab8cSAndroid Build Coastguard WorkerThe tests here works with Mobly in AOSP as well as from GitHub (https://github.com/google/mobly). 6*cf78ab8cSAndroid Build Coastguard Worker 7*cf78ab8cSAndroid Build Coastguard Worker## Instructions 8*cf78ab8cSAndroid Build Coastguard WorkerThe Mobly tests generally assume android devices are already running on the host. 9*cf78ab8cSAndroid Build Coastguard WorkerPrior to running the example tests please start two android virtual devices and verify they are connected to adb. 10*cf78ab8cSAndroid Build Coastguard Worker 11*cf78ab8cSAndroid Build Coastguard Worker### To run using AOSP Mobly: 12*cf78ab8cSAndroid Build Coastguard WorkerEnsure you are using Cuttlefish virtual device when launching with atest. AOSP Mobly support was developed with Cuttlefish only. 13*cf78ab8cSAndroid Build Coastguard WorkerRunning with Goldfish emulator isn't fully supported and may encounter errors such as apk install failures. 14*cf78ab8cSAndroid Build Coastguard Worker 15*cf78ab8cSAndroid Build Coastguard WorkerSimply invoke atest on the test module defined in Android.bp: 16*cf78ab8cSAndroid Build Coastguard Worker* `atest ble-gatt-test` 17*cf78ab8cSAndroid Build Coastguard Worker 18*cf78ab8cSAndroid Build Coastguard Worker### To run with standalone AOSP Mobly runner: 19*cf78ab8cSAndroid Build Coastguard Worker 20*cf78ab8cSAndroid Build Coastguard WorkerUse Mobly's local test runner script with the test module and Mobly YAML config file: 21*cf78ab8cSAndroid Build Coastguard Worker* `tools/test/mobly_extensions/scripts/local_mobly_runner.py -m ble-gatt-test -c tools/netsim/testing/mobly/sample_config.yml` 22*cf78ab8cSAndroid Build Coastguard Worker 23*cf78ab8cSAndroid Build Coastguard WorkerRefer to the `local_mobly_runner.py` script or Mobly documentation for additional info about the runner. 24*cf78ab8cSAndroid Build Coastguard Worker 25*cf78ab8cSAndroid Build Coastguard Worker### To run with Mobly on GitHub: 26*cf78ab8cSAndroid Build Coastguard Worker 27*cf78ab8cSAndroid Build Coastguard Worker1. Clone the open source Mobly on GitHub (https://github.com/google/mobly) 28*cf78ab8cSAndroid Build Coastguard Worker2. Either place the example tests under your Mobly checkout or otherwise handle importing / installing Mobly manually. 29*cf78ab8cSAndroid Build Coastguard Worker3. Ensure mobly bundled snippets (https://github.com/google/mobly-bundled-snippets) is installed on the devices. 30*cf78ab8cSAndroid Build Coastguard Worker4. Execute Mobly test with python and use the Mobly YAML config file. Example command: 31*cf78ab8cSAndroid Build Coastguard Worker * `python3 ./tests/betosim/ble_gatt_test.py -c ./tests/betosim/sample_config.yml` 32*cf78ab8cSAndroid Build Coastguard Worker 33