Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(247)

Side by Side Diff: build/android/run_uiautomator_tests.py

Issue 15942016: Creates a new test running script test_runner.py (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes based on code review Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« build/android/run_tests.py ('K') | « build/android/run_tests.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Runs both the Python and Java UIAutomator tests.""" 7 """Runs both the Python and Java UIAutomator tests."""
8 8
9 import optparse 9 import logging
10 import os 10 import os
11 import subprocess
11 import sys 12 import sys
12 import time
13
14 from pylib import buildbot_report
15 from pylib import constants
16 from pylib import ports
17 from pylib.base import base_test_result
18 from pylib.host_driven import run_python_tests
19 from pylib.uiautomator import dispatch
20 from pylib.utils import report_results
21 from pylib.utils import run_tests_helper
22 from pylib.utils import test_options_parser
23
24
25 def DispatchUIAutomatorTests(options):
26 """Dispatches the UIAutomator tests, sharding if possible.
27
28 Uses the logging module to print the combined final results and
29 summary of the Java and Python tests. If the java_only option is set, only
30 the Java tests run. If the python_only option is set, only the python tests
31 run. If neither are set, run both Java and Python tests.
32
33 Args:
34 options: command-line options for running the Java and Python tests.
35
36 Returns:
37 An integer representing the number of broken tests.
38 """
39 if not options.keep_test_server_ports:
40 # Reset the test port allocation. It's important to do it before starting
41 # to dispatch any tests.
42 if not ports.ResetTestServerPortAllocation():
43 raise Exception('Failed to reset test server port.')
44
45 all_results = base_test_result.TestRunResults()
46
47 if options.run_java_tests:
48 all_results.AddTestRunResults(dispatch.Dispatch(options))
49 if options.run_python_tests:
50 all_results.AddTestRunResults(run_python_tests.DispatchPythonTests(options))
51
52 report_results.LogFull(
53 results=all_results,
54 test_type='UIAutomator',
55 test_package=os.path.basename(options.test_jar),
56 annotation=options.annotations,
57 build_type=options.build_type,
58 flakiness_server=options.flakiness_dashboard_server)
59
60 return len(all_results.GetNotPass())
61
62
63 def main(argv):
64 option_parser = optparse.OptionParser()
65 test_options_parser.AddUIAutomatorOptions(option_parser)
66 options, args = option_parser.parse_args(argv)
67 test_options_parser.ValidateUIAutomatorOptions(option_parser, options, args)
68
69 run_tests_helper.SetLogLevel(options.verbose_count)
70 ret = 1
71 try:
72 ret = DispatchUIAutomatorTests(options)
73 finally:
74 buildbot_report.PrintStepResultIfNeeded(options, ret)
75 return ret
76
77 13
78 if __name__ == '__main__': 14 if __name__ == '__main__':
79 sys.exit(main(sys.argv)) 15 args = ["python",
16 os.path.expandvars("$CHROME_SRC/build/android/run_all_tests.py"),
17 "--uiautomatortests"] + sys.argv[1:]
18 logging.warning("This script is deprecated. "
19 "The preferred command is: %s" % (' '.join(args)))
20 sys.exit(subprocess.call(args))
craigdh 2013/06/12 18:37:03 ditto
gkanwar 2013/06/13 00:12:34 Done.
OLDNEW
« build/android/run_tests.py ('K') | « build/android/run_tests.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698