Commit 3932d125 authored by rnephew's avatar rnephew Committed by Commit bot

Use upload test to get uirobot test id.

BUG=

Review URL: https://codereview.chromium.org/872783003

Cr-Commit-Position: refs/heads/master@{#312946}
parent 8ce41c81
...@@ -19,7 +19,7 @@ from pylib.remote.device import remote_device_helper ...@@ -19,7 +19,7 @@ from pylib.remote.device import remote_device_helper
from pylib.utils import zip_utils from pylib.utils import zip_utils
class RemoteDeviceTestRun(test_run.TestRun): class RemoteDeviceTestRun(test_run.TestRun):
"""Run gtests and uirobot tests on a remote device.""" """Run tests on a remote device."""
_TEST_RUN_KEY = 'test_run' _TEST_RUN_KEY = 'test_run'
_TEST_RUN_ID_KEY = 'test_run_id' _TEST_RUN_ID_KEY = 'test_run_id'
......
...@@ -51,10 +51,31 @@ class RemoteDeviceUirobotTestRun(remote_device_test_run.RemoteDeviceTestRun): ...@@ -51,10 +51,31 @@ class RemoteDeviceUirobotTestRun(remote_device_test_run.RemoteDeviceTestRun):
logging.info('Using default runner type: %s', default_runner_type) logging.info('Using default runner type: %s', default_runner_type)
else: else:
runner_type = self._env.runner_type runner_type = self._env.runner_type
self._test_id = self._GetTestByName(runner_type)
self._test_id = self._UploadTestToDevice(
'android_robot', None, app_id=self._app_id)
config_body = {'duration': self._test_instance.minutes} config_body = {'duration': self._test_instance.minutes}
self._SetTestConfig(runner_type, config_body) self._SetTestConfig(runner_type, config_body)
# TODO(rnephew): Switch to base class implementation when supported.
#override
def _UploadTestToDevice(self, test_type, test_path, app_id=None):
if test_path:
logging.info("Ignoring test path.")
data = {
'access_token':self._env.token,
'test_type':test_type,
'app_id':app_id,
}
with appurify_sanitized.SanitizeLogging(self._env.verbose_count,
logging.WARNING):
test_upload_res = appurify_sanitized.utils.post('tests/upload',
data, None)
remote_device_helper.TestHttpResponse(
test_upload_res, 'Unable to get UiRobot test id.')
return test_upload_res.json()['response']['test_id']
#override #override
def _ParseTestResults(self): def _ParseTestResults(self):
logging.info('Parsing results from remote service.') logging.info('Parsing results from remote service.')
......
...@@ -140,7 +140,6 @@ def AddRemoteDeviceOptions(parser): ...@@ -140,7 +140,6 @@ def AddRemoteDeviceOptions(parser):
group.add_argument('--runner-type', default='', group.add_argument('--runner-type', default='',
help='Type of test to run as.') help='Type of test to run as.')
group.add_argument('--runner-package', help='Package name of test.') group.add_argument('--runner-package', help='Package name of test.')
group.add_argument('--app-under-test', help='APK to run tests on.')
group.add_argument('--device-type', default='Android', group.add_argument('--device-type', default='Android',
choices=constants.VALID_DEVICE_TYPES, choices=constants.VALID_DEVICE_TYPES,
help=('Type of device to run on. iOS or android')) help=('Type of device to run on. iOS or android'))
...@@ -507,6 +506,7 @@ def AddUirobotTestOptions(parser): ...@@ -507,6 +506,7 @@ def AddUirobotTestOptions(parser):
"""Adds uirobot test options to |option_parser|.""" """Adds uirobot test options to |option_parser|."""
group = parser.add_argument_group('Uirobot Test Options') group = parser.add_argument_group('Uirobot Test Options')
group.add_argument('--app-under-test', help='APK to run tests on.')
group.add_argument( group.add_argument(
'--minutes', default=5, type=int, '--minutes', default=5, type=int,
help='Number of minutes to run uirobot test [default: %default].') help='Number of minutes to run uirobot test [default: %default].')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment