Bug 928842 - Fix xml-report generation, r=davehunt
authorJonathan Griffin <jgriffin@mozilla.com>
Mon, 21 Oct 2013 15:53:42 -0700
changeset 166391 a39ed7f81b1ab30c5d1df9303399869867e58e53
parent 166390 a31b0fd17a7a7826bf5f936f632aa2c016cea097
child 166392 4942026233a46ba5f5e115c6d156d5da20d6cb8c
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdavehunt
bugs928842
milestone27.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 928842 - Fix xml-report generation, r=davehunt
testing/marionette/client/marionette/runtests.py
--- a/testing/marionette/client/marionette/runtests.py
+++ b/testing/marionette/client/marionette/runtests.py
@@ -628,23 +628,23 @@ class MarionetteTestRunner(object):
     def cleanup(self):
         if self.httpd:
             self.httpd.stop()
 
     __del__ = cleanup
 
     def generate_xml(self, results_list):
 
-        def _extract_xml(test, text='', result='passed'):
-            cls_name = test.__class__.__name__
-
+        def _extract_xml(test, class_name, text='', result='passed'):
             testcase = doc.createElement('testcase')
-            testcase.setAttribute('classname', cls_name)
+            testcase.setAttribute('classname', class_name)
             testcase.setAttribute('name', unicode(test).split()[0])
-            testcase.setAttribute('time', str(test.duration))
+            # XXX - Bug 927606
+            # testcase.setAttribute('time', str(test.duration))
+            testcase.setAttribute('time', '0')
             testsuite.appendChild(testcase)
 
             if result in ['failure', 'error', 'skipped']:
                 f = doc.createElement(result)
                 f.setAttribute('message', 'test %s' % result)
                 f.appendChild(doc.createTextNode(text))
                 testcase.appendChild(f)
 
@@ -668,37 +668,37 @@ class MarionetteTestRunner(object):
                                              for results in results_list])))
         if hasattr(results, 'skipped'):
             testsuite.setAttribute('skips', str(sum([len(results.skipped) +
                                                      len(results.expectedFailures)
                                                      for results in results_list])))
 
         for results in results_list:
 
-            for tup in results.errors:
-                _extract_xml(tup[0], text=tup[1], result='error')
+            for result in results.errors:
+                _extract_xml(result.name, result.test_class, text=result.reason, result='error')
 
-            for tup in results.failures:
-                _extract_xml(tup[0], text=tup[1], result='failure')
+            for result in results.failures:
+                _extract_xml(result.name, result.test_class, text=result.reason, result='failure')
 
             if hasattr(results, 'unexpectedSuccesses'):
                 for test in results.unexpectedSuccesses:
                     # unexpectedSuccesses is a list of Testcases only, no tuples
-                    _extract_xml(test, text='TEST-UNEXPECTED-PASS', result='failure')
+                    _extract_xml(test, result.test_class, text='TEST-UNEXPECTED-PASS', result='failure')
 
             if hasattr(results, 'skipped'):
-                for tup in results.skipped:
-                    _extract_xml(tup[0], text=tup[1], result='skipped')
+                for result in results.skipped:
+                    _extract_xml(result.name, result.test_class, text=result.reason, result='skipped')
 
             if hasattr(results, 'expectedFailures'):
-                for tup in results.expectedFailures:
-                    _extract_xml(tup[0], text=tup[1], result='skipped')
+                for result in results.expectedFailures:
+                    _extract_xml(result.name, result.test_class, text=result.reason, result='skipped')
 
-            for test in results.tests_passed:
-                _extract_xml(test)
+            for result in results.tests_passed:
+                _extract_xml(result.name, result.test_class)
 
         doc.appendChild(testsuite)
         return doc.toprettyxml(encoding='utf-8')
 
 
 class MarionetteTestOptions(OptionParser):
 
     def __init__(self, **kwargs):