Use upload test to get uirobot test id.

BUG=

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

Cr-Original-Commit-Position: refs/heads/master@{#312946}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 3932d125d7a8c73e41fc1f768d5ea443f349aa9d
This commit is contained in:
rnephew 2015-01-23 14:20:14 -08:00 коммит произвёл Commit bot
Родитель 3d204626c7
Коммит f5a3874ebf
3 изменённых файлов: 24 добавлений и 3 удалений

Просмотреть файл

@ -19,7 +19,7 @@ from pylib.remote.device import remote_device_helper
from pylib.utils import zip_utils
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_ID_KEY = 'test_run_id'

Просмотреть файл

@ -51,10 +51,31 @@ class RemoteDeviceUirobotTestRun(remote_device_test_run.RemoteDeviceTestRun):
logging.info('Using default runner type: %s', default_runner_type)
else:
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}
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
def _ParseTestResults(self):
logging.info('Parsing results from remote service.')

Просмотреть файл

@ -140,7 +140,6 @@ def AddRemoteDeviceOptions(parser):
group.add_argument('--runner-type', default='',
help='Type of test to run as.')
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',
choices=constants.VALID_DEVICE_TYPES,
help=('Type of device to run on. iOS or android'))
@ -507,6 +506,7 @@ def AddUirobotTestOptions(parser):
"""Adds uirobot test options to |option_parser|."""
group = parser.add_argument_group('Uirobot Test Options')
group.add_argument('--app-under-test', help='APK to run tests on.')
group.add_argument(
'--minutes', default=5, type=int,
help='Number of minutes to run uirobot test [default: %default].')