Skip to content

Commit 4880259

Browse files
author
yennj12
committed
add
1 parent 5475ca5 commit 4880259

File tree

3 files changed

+47
-0
lines changed

3 files changed

+47
-0
lines changed

mobly/README.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Mobly
2+
3+
## Setup
4+
5+
```bash
6+
7+
pip install mobly
8+
```
9+
10+
## Cmd
11+
12+
```bash
13+
14+
#-----------------------
15+
# Exp 1
16+
#-----------------------
17+
18+
python3 hello_world_test.py -c sample_config.yml
19+
```
20+
21+
22+
## Ref
23+
- https://github.com/google/mobly/blob/master/docs/tutorial.md

mobly/hello_world_test.py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from mobly import base_test
2+
from mobly import test_runner
3+
from mobly.controllers import android_device
4+
5+
class HelloWorldTest(base_test.BaseTestClass):
6+
def setup_class(self):
7+
# Registering android_device controller module declares the test's
8+
# dependency on Android device hardware. By default, we expect at least one
9+
# object is created from this.
10+
self.ads = self.register_controller(android_device)
11+
self.dut = self.ads[0]
12+
# Start Mobly Bundled Snippets (MBS).
13+
self.dut.load_snippet('mbs', android_device.MBS_PACKAGE)
14+
15+
def test_hello(self):
16+
self.dut.mbs.makeToast('Hello World!')
17+
18+
if __name__ == '__main__':
19+
test_runner.main()

mobly/sample_config.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
TestBeds:
2+
# A test bed where adb will find Android devices.
3+
- Name: SampleTestBed
4+
Controllers:
5+
AndroidDevice: '*'

0 commit comments

Comments
 (0)