1# NBU Connectivity Test Suite
2
3This suite includes tests that exercises Android connectivity APIs and verify
4device behaviors.
5
6## Overview
7
8These tests simulate connectivity use cases critical to NBU market like
9peer-to-peer interactions.
10
11We created these tests using tools from the open source project Mobly, if you
12want to learn more, see its [Github page](https://github.com/google/mobly) and
13[tutorial](https://github.com/google/mobly/blob/master/docs/tutorial.md).
14
15The tests have two components, an agent apk running on the Android Device Under
16Test (DUT) and Python test scripts running on a computer to which the DUTs are
17connected via USB. The tests issue cmds to the agent on the device to trigger
18actions and read status, thus coordinating actions across multiple devices.
19
20The tests by default write output to `/tmp/logs`.
21
22## Test Environment Setup
23
24This section lists the components and steps required to create a setup to run
25these tests.
26
27### Test Zip File
28
29This is a zip file that you have downloaded.
30
31The zip file includes:
32
33*   this README file
34*   an apk called `android_snippet.apk`
35*   several Python files.
36
37### Two Android Devices (DUT)
38
39The two devices should be of the same model and build (identical fingerprint).
40
41On each device:
42
43*   Flash the build you want to test. The build's API level has to be `>=26`.
44*   Enable USB debugging.
45*   Enable BT snoop log.
46*   Enable Wi-Fi verbose log.
47*   Enable location service.
48*   Install the `android_snippet.apk` with opition -g.
49
50#### Create a test config file
51
52Based on the two devices' serial numbers, we need to create a config file.
53
54Create a plain text file `config.yaml` in the following format, with the `<>`
55blocks replaced with the information of your actual devices:
56
57```
58TestBeds:
59  - Name: P2pTestBed
60    Controllers:
61        AndroidDevice:
62          - serial: <DUT1 serial>
63          - serial: <DUT2 serial>
64```
65
66### Linux Computer (Ubuntu 14.04+)
67
68We need the following packages:
69
70*   adb
71*   Python 2.7+
72
73To check your Python's version, use command `$ python --version`.
74
75In addition to those, we also need to install a few other tools:
76
77```
78$ sudo apt-get install python-setuptools python-pip
79$ pip install mobly
80```
81
82After all the tools are installed, connect the devices to the computer with USB
83cables and make sure they show up as "device" in the output of `$ adb devices`
84
85## Test Execution
86
87First, you need to put the file `config.yaml` in the same directory as the
88Python scripts. Then cd to that directory and run:
89
90```
91$ rm -rf /tmp/logs/ # Clear previous logs
92$ python xxx_test.py -c config.yaml
93```
94
95Execute all the `*_test.py` files the same way. Once they all finish executing,
96all the logs will be collected in `/tmp/logs/`. You can check the test results
97and debug info there.
98
99Zip up the content of `/tmp/logs/` and send it to your contact at Google.
100