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

Side by Side Diff: chrome/test/chromedriver/run_java_tests.py

Issue 14130017: [chromedriver] Add option to relaunch the test harness after each java test for debugging. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed nits Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/test/chromedriver/java_tests.txt ('k') | chrome/test/chromedriver/test_environment.py » ('j') | 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 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Runs the WebDriver Java acceptance tests. 6 """Runs the WebDriver Java acceptance tests.
7 7
8 This script is called from chrome/test/chromedriver/run_all_tests.py and reports 8 This script is called from chrome/test/chromedriver/run_all_tests.py and reports
9 results using the buildbot annotation scheme. 9 results using the buildbot annotation scheme.
10 10
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 parser.add_option( 233 parser.add_option(
234 '', '--chrome-version', default='HEAD', 234 '', '--chrome-version', default='HEAD',
235 help='Version of chrome. Default is \'HEAD\'') 235 help='Version of chrome. Default is \'HEAD\'')
236 parser.add_option( 236 parser.add_option(
237 '', '--android-package', type='string', default=None, 237 '', '--android-package', type='string', default=None,
238 help='Name of Chrome\'s Android package') 238 help='Name of Chrome\'s Android package')
239 parser.add_option( 239 parser.add_option(
240 '', '--filter', type='string', default=None, 240 '', '--filter', type='string', default=None,
241 help='Filter for specifying what tests to run, "*" will run all. E.g., ' 241 help='Filter for specifying what tests to run, "*" will run all. E.g., '
242 '*testShouldReturnTitleOfPageIfSet') 242 '*testShouldReturnTitleOfPageIfSet')
243 parser.add_option(
244 '', '--isolate-tests', action='store_true', default=False,
245 help='Relaunch the jar test harness after each test')
243 options, args = parser.parse_args() 246 options, args = parser.parse_args()
244 247
245 if options.chromedriver is None or not os.path.exists(options.chromedriver): 248 if options.chromedriver is None or not os.path.exists(options.chromedriver):
246 parser.error('chromedriver is required or the given path is invalid.' + 249 parser.error('chromedriver is required or the given path is invalid.' +
247 'Please run "%s --help" for help' % __file__) 250 'Please run "%s --help" for help' % __file__)
248 251
249 if options.android_package is not None: 252 if options.android_package is not None:
250 if options.chrome_version != 'HEAD': 253 if options.chrome_version != 'HEAD':
251 parser.error('Android does not support the --chrome-version argument.') 254 parser.error('Android does not support the --chrome-version argument.')
252 environment = test_environment.AndroidTestEnvironment() 255 environment = test_environment.AndroidTestEnvironment()
253 else: 256 else:
254 environment = test_environment.DesktopTestEnvironment( 257 environment = test_environment.DesktopTestEnvironment(
255 options.chrome_version) 258 options.chrome_version)
256 259
257 try: 260 try:
258 environment.GlobalSetUp() 261 environment.GlobalSetUp()
259 # Run passed tests when filter is not provided. 262 # Run passed tests when filter is not provided.
260 test_filter = options.filter 263 if options.filter:
261 if test_filter is None: 264 test_filters = [options.filter]
262 test_filter = environment.GetPassedJavaTestFilter() 265 else:
266 if options.isolate_tests:
267 test_filters = environment.GetPassedJavaTests()
268 else:
269 test_filters = [environment.GetPassedJavaTestFilter()]
263 270
264 java_tests_src_dir = os.path.join(chrome_paths.GetSrc(), 'chrome', 'test', 271 java_tests_src_dir = os.path.join(chrome_paths.GetSrc(), 'chrome', 'test',
265 'chromedriver', 'third_party', 272 'chromedriver', 'third_party',
266 'java_tests') 273 'java_tests')
267 if (not os.path.exists(java_tests_src_dir) or 274 if (not os.path.exists(java_tests_src_dir) or
268 not os.listdir(java_tests_src_dir)): 275 not os.listdir(java_tests_src_dir)):
269 print ('"%s" is empty or it doesn\'t exist.' % java_tests_src_dir + 276 print ('"%s" is empty or it doesn\'t exist.' % java_tests_src_dir +
270 'Should add "deps/third_party/webdriver" to source checkout config') 277 'Should add "deps/third_party/webdriver" to source checkout config')
271 return 1 278 return 1
272 279
273 return PrintTestResults(_Run( 280 results = []
274 java_tests_src_dir=java_tests_src_dir, 281 for filter in test_filters:
275 test_filter=test_filter, 282 results += _Run(
276 chromedriver_path=options.chromedriver, 283 java_tests_src_dir=java_tests_src_dir,
277 chrome_path=options.chrome, 284 test_filter=filter,
278 android_package=options.android_package, 285 chromedriver_path=options.chromedriver,
279 verbose=options.verbose, 286 chrome_path=options.chrome,
280 debug=options.debug)) 287 android_package=options.android_package,
288 verbose=options.verbose,
289 debug=options.debug)
290 return PrintTestResults(results)
281 finally: 291 finally:
282 environment.GlobalTearDown() 292 environment.GlobalTearDown()
283 293
284 294
285 if __name__ == '__main__': 295 if __name__ == '__main__':
286 sys.exit(main()) 296 sys.exit(main())
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/java_tests.txt ('k') | chrome/test/chromedriver/test_environment.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698