示例#1
0
 def test_push(self):
     jars = ["bundle.jar", "uiautomator-stub.jar"]
     server = AutomatorServer()
     server.adb = MagicMock()
     self.assertEqual(set(server.push()), set(jars))
     for args in server.adb.cmd.call_args_list:
         self.assertEqual(args[0][0], "push")
         self.assertEqual(args[0][2], "/data/local/tmp/")
示例#2
0
 def test_push(self):
     jars = ["bundle.jar", "uiautomator-stub.jar"]
     server = AutomatorServer()
     server.adb = MagicMock()
     self.assertEqual(set(server.push()), set(jars))
     for args in server.adb.cmd.call_args_list:
         self.assertEqual(args[0][0], "push")
         self.assertEqual(args[0][2], "/data/local/tmp/")
示例#3
0
 def test_start_success(self):
     server = AutomatorServer()
     server.push = MagicMock()
     server.push.return_value = ["bundle.jar", "uiautomator-stub.jar"]
     server.ping = MagicMock()
     server.ping.return_value = "pong"
     server.adb = MagicMock()
     server.start()
     server.adb.cmd.assert_valled_onec_with('shell', 'uiautomator', 'runtest', 'bundle.jar', 'uiautomator-stub.jar', '-c', 'com.github.uiautomatorstub.Stub')
示例#4
0
 def test_start_success(self):
     server = AutomatorServer()
     server.push = MagicMock()
     server.push.return_value = ["bundle.jar", "uiautomator-stub.jar"]
     server.ping = MagicMock()
     server.ping.return_value = "pong"
     server.adb = MagicMock()
     server.start()
     server.adb.cmd.assert_called_with('shell', 'uiautomator', 'runtest', 'bundle.jar', 'uiautomator-stub.jar', '-c', 'com.github.uiautomatorstub.Stub')
示例#5
0
 def test_start_error(self):
     server = AutomatorServer()
     server.push = MagicMock()
     server.push.return_value = ["bundle.jar", "uiautomator-stub.jar"]
     server.ping = MagicMock()
     server.ping.return_value = None
     server.adb = MagicMock()
     with patch("time.sleep"):
         with self.assertRaises(IOError):
             server.start()
示例#6
0
 def test_start_error(self):
     server = AutomatorServer()
     server.push = MagicMock()
     server.push.return_value = ["bundle.jar", "uiautomator-stub.jar"]
     server.ping = MagicMock()
     server.ping.return_value = None
     server.adb = MagicMock()
     with patch("time.sleep"):
         with self.assertRaises(IOError):
             server.start()
示例#7
0
    def test_start_success_over_api_18(self):
        server = AutomatorServer()
        server.push = MagicMock()
        server.push.return_value = ["bundle.jar", "uiautomator-stub.jar"]

        server.ping = MagicMock()
        server.ping.return_value = "pong"

        server.sdk_version = MagicMock()
        server.sdk_version.return_value = 20

        server.adb = MagicMock()
        server.start()
        server.adb.cmd.assert_called_with(
            "shell", "am", "instrument", "-w",
            "com.github.uiautomator.test/android.support.test.runner.AndroidJUnitRunner"
        )