README.md
1 # NBU Connectivity Test Suite
2
3 This suite includes tests that exercises Android connectivity APIs and verify
4 device behaviors.
5
6 ## Overview
7
8 These tests simulate connectivity use cases critical to NBU market like
9 peer-to-peer interactions.
10
11 We created these tests using tools from the open source project Mobly, if you
12 want 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
15 The tests have two components, an agent apk running on the Android Device Under
16 Test (DUT) and Python test scripts running on a computer to which the DUTs are
17 connected via USB. The tests issue cmds to the agent on the device to trigger
18 actions and read status, thus coordinating actions across multiple devices.
19
20 The tests by default write output to `/tmp/logs`.
21
22 ## Test Environment Setup
23
24 This section lists the components and steps required to create a setup to run
25 these tests.
26
27 ### Test Zip File
28
29 This is a zip file that you have downloaded.
30
31 The 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
39 The two devices should be of the same model and build (identical fingerprint).
40
41 On 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
52 Based on the two devices' serial numbers, we need to create a config file.
53
54 Create a plain text file `config.yaml` in the following format, with the `<>`
55 blocks replaced with the information of your actual devices:
56
57 ```
58 TestBeds:
59 - Name: P2pTestBed
60 Controllers:
61 AndroidDevice:
62 - serial: <DUT1 serial>
63 - serial: <DUT2 serial>
64 ```
65
66 ### Linux Computer (Ubuntu 14.04+)
67
68 We need the following packages:
69
70 * adb
71 * Python 2.7+
72
73 To check your Python's version, use command `$ python --version`.
74
75 In 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
82 After all the tools are installed, connect the devices to the computer with USB
83 cables and make sure they show up as "device" in the output of `$ adb devices`
84
85 ## Test Execution
86
87 First, you need to put the file `config.yaml` in the same directory as the
88 Python 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
95 Execute all the `*_test.py` files the same way. Once they all finish executing,
96 all the logs will be collected in `/tmp/logs/`. You can check the test results
97 and debug info there.
98
99 Zip up the content of `/tmp/logs/` and send it to your contact at Google.
100