OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """The testing Environment class. | 5 """The testing Environment class. |
6 | 6 |
7 It holds the WebsiteTest instances, provides them with credentials, | 7 It holds the WebsiteTest instances, provides them with credentials, |
8 provides clean browser environment, runs the tests, and gathers the | 8 provides clean browser environment, runs the tests, and gathers the |
9 results. | 9 results. |
10 """ | 10 """ |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 for websitetest in self.websitetests: | 281 for websitetest in self.websitetests: |
282 successful = True | 282 successful = True |
283 error = "" | 283 error = "" |
284 try: | 284 try: |
285 # TODO(melandory): Implement a decorator for WesiteTest methods | 285 # TODO(melandory): Implement a decorator for WesiteTest methods |
286 # which allows to mark them as test cases. And then add a check if | 286 # which allows to mark them as test cases. And then add a check if |
287 # test_case_name is a valid test case. | 287 # test_case_name is a valid test case. |
288 getattr(websitetest, test_case_name)() | 288 getattr(websitetest, test_case_name)() |
289 except Exception as e: | 289 except Exception as e: |
290 successful = False | 290 successful = False |
291 error = e.message | 291 # httplib.CannotSendRequest doesn't define a message, |
| 292 # so type(e).__name__ will at least log exception name as a reason. |
| 293 # TODO(melandory): logging.exception(e) produces meaningful result |
| 294 # for httplib.CannotSendRequest, so we can try to propagate information |
| 295 # that reason is an exception to the logging phase. |
| 296 error = "Exception %s %s" % (type(e).__name__, e) |
292 self.tests_results.append( | 297 self.tests_results.append( |
293 (websitetest.name, test_case_name, successful, error)) | 298 (websitetest.name, test_case_name, successful, error)) |
294 | 299 |
295 def Quit(self): | 300 def Quit(self): |
296 """Shuts down the driver.""" | 301 """Shuts down the driver.""" |
297 | 302 |
298 self.driver.quit() | 303 self.driver.quit() |
OLD | NEW |