File tree Expand file tree Collapse file tree 2 files changed +45
-5
lines changed
Expand file tree Collapse file tree 2 files changed +45
-5
lines changed Original file line number Diff line number Diff line change @@ -45,17 +45,15 @@ adb devices
4545
4646# https://github.com/google/mobly/blob/master/docs/tutorial.md
4747
48+ cd ~ && source yen_py_env/bin/activate
49+
4850
4951# -----------------------
5052# TEST 1
5153# -----------------------
5254
5355python3 hello_world_test.py -c sample_config.yml
5456
55-
56- python3 test_1.py -c sample_config.yml
57-
58-
5957# -----------------------
6058# TEST 2
6159# -----------------------
@@ -83,7 +81,14 @@ python3 many_greetings_test.py -c sample_config.yml
8381
8482
8583# -----------------------
86- # TEST 2
84+ # TEST 5
85+ # -----------------------
86+
87+ python3 open_setting_test.py -c sample_config.yml
88+
89+
90+ # -----------------------
91+ # TEST ?
8792# -----------------------
8893
8994python3 instrumentation_test.py -c sample_config.yml
Original file line number Diff line number Diff line change 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+ print (">>> HelloWorldTest start" )
8+
9+ # Registering android_device controller module declares the test's
10+ # dependency on Android device hardware. By default, we expect at least one
11+ # object is created from this.
12+ print (">>> android_device = " + str (android_device ))
13+ self .ads = self .register_controller (android_device )
14+ self .dut = self .ads [0 ]
15+ print (">>> self.ads = " + str (self .ads ))
16+ print (">>> self.dut = " + str (self .dut ))
17+
18+ # Start Mobly Bundled Snippets (MBS).
19+ self .dut .load_snippet ('mbs' , android_device .MBS_PACKAGE )
20+
21+ def test_open_settings (self ):
22+ # Open Settings app using adb command
23+ print (">>> Opening Settings app on the Android device." )
24+
25+ # Command to open the Settings app
26+ self .dut .adb .shell ('am start -a android.settings.SETTINGS' )
27+
28+ # Optional: Add a sleep or some verification if needed to ensure the app opened
29+ self .dut .adb .shell ('sleep 5' ) # sleep for 2 seconds to allow Settings to open
30+
31+ def test_hello (self ):
32+ self .dut .mbs .makeToast ('>>> Hello World!' )
33+
34+ if __name__ == '__main__' :
35+ test_runner .main ()
You can’t perform that action at this time.
0 commit comments