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

Side by Side Diff: tools/testing/run_selenium.py

Issue 11098013: Give more debug info from selenium driver. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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 | « no previous file | 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/python 1 #!/usr/bin/python
2 2
3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
4 # for details. All rights reserved. Use of this source code is governed by a 4 # for details. All rights reserved. Use of this source code is governed by a
5 # BSD-style license that can be found in the LICENSE file. 5 # BSD-style license that can be found in the LICENSE file.
6 # 6 #
7 7
8 """Script to actually open a browser and perform the test, and reports back with 8 """Script to actually open a browser and perform the test, and reports back with
9 the result. It uses Selenium WebDriver when possible for running the tests. It 9 the result. It uses Selenium WebDriver when possible for running the tests. It
10 uses Selenium RC for Safari. 10 uses Selenium RC for Safari.
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 current_browser_name = None 281 current_browser_name = None
282 282
283 # TODO(jmesserly): It'd be nice to shutdown gracefully in the event of a 283 # TODO(jmesserly): It'd be nice to shutdown gracefully in the event of a
284 # SIGTERM. Unfortunately dart:io cannot send SIGTERM, see dartbug.com/1756. 284 # SIGTERM. Unfortunately dart:io cannot send SIGTERM, see dartbug.com/1756.
285 signal.signal(signal.SIGTERM, lambda number, frame: close_browser(browser)) 285 signal.signal(signal.SIGTERM, lambda number, frame: close_browser(browser))
286 286
287 try: 287 try:
288 while True: 288 while True:
289 line = sys.stdin.readline() 289 line = sys.stdin.readline()
290 if line == '--terminate\n': 290 if line == '--terminate\n':
291 print("Terminating selenium driver")
291 break 292 break
292 293
293 (html_out, browser_name, executable_path, 294 (html_out, browser_name, executable_path,
294 timeout, mode) = parse_args(line.split()) 295 timeout, mode) = parse_args(line.split())
295 296
296 # Sanity checks that test.dart is passing flags we can handle. 297 # Sanity checks that test.dart is passing flags we can handle.
297 if mode != 'correctness': 298 if mode != 'correctness':
298 print 'Batch test runner not compatible with perf testing' 299 print 'Batch test runner not compatible with perf testing'
299 return 1 300 return 1
300 if browser and current_browser_name != browser_name: 301 if browser and current_browser_name != browser_name:
(...skipping 16 matching lines...) Expand all
317 # >>> TEST {PASS, FAIL, OK, CRASH, FAIL, TIMEOUT} 318 # >>> TEST {PASS, FAIL, OK, CRASH, FAIL, TIMEOUT}
318 status = report_results(mode, source, browser) 319 status = report_results(mode, source, browser)
319 if status == 0: 320 if status == 0:
320 print '>>> TEST PASS' 321 print '>>> TEST PASS'
321 elif source == TIMEOUT_ERROR_MSG: 322 elif source == TIMEOUT_ERROR_MSG:
322 print '>>> TEST TIMEOUT' 323 print '>>> TEST TIMEOUT'
323 else: 324 else:
324 print '>>> TEST FAIL' 325 print '>>> TEST FAIL'
325 sys.stdout.flush() 326 sys.stdout.flush()
326 finally: 327 finally:
328 print("Closing browser");
327 close_browser(browser) 329 close_browser(browser)
328 330
329 331
330 def main(args): 332 def main(args):
331 # Run in batch mode if the --batch flag is passed. 333 # Run in batch mode if the --batch flag is passed.
332 # TODO(jmesserly): reconcile with the existing args parsing 334 # TODO(jmesserly): reconcile with the existing args parsing
333 if '--batch' in args: 335 if '--batch' in args:
334 return run_batch_tests() 336 return run_batch_tests()
335 337
336 # Run a single test 338 # Run a single test
337 html_out, browser_name, executable_path, timeout, mode = parse_args() 339 html_out, browser_name, executable_path, timeout, mode = parse_args()
338 browser = start_browser(browser_name, executable_path, html_out) 340 browser = start_browser(browser_name, executable_path, html_out)
339 341
340 try: 342 try:
341 output = run_test_in_browser(browser, html_out, timeout, mode) 343 output = run_test_in_browser(browser, html_out, timeout, mode)
342 return report_results(mode, output, browser) 344 return report_results(mode, output, browser)
343 finally: 345 finally:
344 close_browser(browser) 346 close_browser(browser)
345 347
346 if __name__ == "__main__": 348 if __name__ == "__main__":
347 sys.exit(main(sys.argv)) 349 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698