Skip to content

Commit 5f43d41

Browse files
author
yennj12
committed
add
1 parent 4af8cf6 commit 5f43d41

File tree

4 files changed

+31
-2
lines changed

4 files changed

+31
-2
lines changed

mobly/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ python3 hello_world_test_2.py -c sample_config.yml
6262

6363
python3 hello_world_test_2.py -c sample_config.yml --test_case test_bye test_hello test_bye
6464

65+
python3 hello_world_test_2.py -c sample_config_2.yml --test_bed AbcTestBed
6566

6667
#-----------------------
6768
# TEST 2

mobly/hello_world_test_2.py

+7
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,12 @@ def test_hello(self):
1616
def test_bye(self):
1717
self.dut.mbs.makeToast('Goodbye! >>>>')
1818

19+
def test_favorite_food(self):
20+
food = self.user_params.get('favorite_food')
21+
if food:
22+
self.dut.mbs.makeToast(">>> I'd like to eat %s." % food)
23+
else:
24+
self.dut.mbs.makeToast(">>> I'm not hungry.")
25+
1926
if __name__ == '__main__':
2027
test_runner.main()

mobly/sample_config.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
TestBeds:
2-
# A test bed where adb will find Android devices.
32
- Name: SampleTestBed
43
Controllers:
5-
AndroidDevice: '*'
4+
AndroidDevice: '*'
5+
TestParams:
6+
favorite_food: Green eggs and ham.

mobly/sample_config_2.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# DefaultParams is optional here. It uses yaml's anchor feature to easily share
2+
# a set of parameters between multiple test bed configs
3+
DefaultParams: &DefaultParams
4+
favorite_food: green eggs and ham.
5+
6+
TestBeds:
7+
- Name: XyzTestBed
8+
Controllers:
9+
AndroidDevice:
10+
- serial: xyz
11+
phone_number: 123456
12+
TestParams:
13+
<<: *DefaultParams
14+
- Name: AbcTestBed
15+
Controllers:
16+
AndroidDevice:
17+
- serial: abc
18+
label: golden_device
19+
TestParams:
20+
<<: *DefaultParams

0 commit comments

Comments
 (0)