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

Unified Diff: build/android/pylib/base/base_test_result.py

Issue 342823004: [Android] Switch long form test result reporting to a gtest-esque format. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | build/android/pylib/base/base_test_result_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/base/base_test_result.py
diff --git a/build/android/pylib/base/base_test_result.py b/build/android/pylib/base/base_test_result.py
index 13d938d84ebaa0454db5724a7b46972373757733..c425d5cd5845650849f6c16ea10d5e97ac62aeda 100644
--- a/build/android/pylib/base/base_test_result.py
+++ b/build/android/pylib/base/base_test_result.py
@@ -88,16 +88,28 @@ class TestRunResults(object):
s.append(log)
return '\n'.join(s)
- def GetLongForm(self):
- """Get the long string representation of this object."""
+ def GetGtestForm(self):
+ """Get the gtest string representation of this object."""
s = []
- s.append('ALL (%d tests)' % len(self._results))
- for test_type in ResultType.GetTypes():
- tests = sorted(self._GetType(test_type))
- if test_type == ResultType.PASS:
- s.append('%s (%d tests)' % (test_type, len(tests)))
- else:
- s.append('%s (%d tests): %s' % (test_type, len(tests), tests))
+ plural = lambda n, s, p: '%d %s' % (n, p if n != 1 else s)
+ tests = lambda n: plural(n, 'test', 'tests')
+
+ s.append('[==========] %s ran.' % (tests(len(self.GetAll()))))
+ s.append('[ PASSED ] %s.' % (tests(len(self.GetPass()))))
+
+ not_passed = self.GetNotPass()
+ if len(not_passed) > 0:
+ s.append('[ FAILED ] %s, listed below:' % tests(len(self.GetNotPass())))
+ for t in self.GetFail():
+ s.append('[ FAILED ] %s' % str(t))
+ for t in self.GetCrash():
+ s.append('[ FAILED ] %s (CRASHED)' % str(t))
+ for t in self.GetTimeout():
+ s.append('[ FAILED ] %s (TIMEOUT)' % str(t))
+ for t in self.GetUnknown():
+ s.append('[ FAILED ] %s (UNKNOWN)' % str(t))
+ s.append('')
+ s.append(plural(len(not_passed), 'FAILED TEST', 'FAILED TESTS'))
return '\n'.join(s)
def GetShortForm(self):
« no previous file with comments | « no previous file | build/android/pylib/base/base_test_result_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698