OLD | NEW |
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 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 """Unittests for TestRunResults.""" | 5 """Unittests for TestRunResults.""" |
6 | 6 |
7 import unittest | 7 import unittest |
8 | 8 |
9 from pylib.base.base_test_result import BaseTestResult | 9 from pylib.base.base_test_result import BaseTestResult |
10 from pylib.base.base_test_result import TestRunResults | 10 from pylib.base.base_test_result import TestRunResults |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 'failure1\n' | 54 'failure1\n' |
55 '[CRASH] c1:\n' | 55 '[CRASH] c1:\n' |
56 'crash1') | 56 'crash1') |
57 self.assertEqual(self.tr.GetLogs(), log_print) | 57 self.assertEqual(self.tr.GetLogs(), log_print) |
58 | 58 |
59 def testGetShortForm(self): | 59 def testGetShortForm(self): |
60 short_print = ('ALL: 5 PASS: 2 FAIL: 1 ' | 60 short_print = ('ALL: 5 PASS: 2 FAIL: 1 ' |
61 'CRASH: 1 TIMEOUT: 0 UNKNOWN: 1 ') | 61 'CRASH: 1 TIMEOUT: 0 UNKNOWN: 1 ') |
62 self.assertEqual(self.tr.GetShortForm(), short_print) | 62 self.assertEqual(self.tr.GetShortForm(), short_print) |
63 | 63 |
64 def testGetLongForm(self): | 64 def testGetGtestForm(self): |
65 long_print = ('ALL (5 tests)\n' | 65 gtest_print = ('[==========] 5 tests ran.\n' |
66 'PASS (2 tests)\n' | 66 '[ PASSED ] 2 tests.\n' |
67 'FAIL (1 tests): [f1]\n' | 67 '[ FAILED ] 3 tests, listed below:\n' |
68 'CRASH (1 tests): [c1]\n' | 68 '[ FAILED ] f1\n' |
69 'TIMEOUT (0 tests): []\n' | 69 '[ FAILED ] c1 (CRASHED)\n' |
70 'UNKNOWN (1 tests): [u1]') | 70 '[ FAILED ] u1 (UNKNOWN)\n' |
71 self.assertEqual(self.tr.GetLongForm(), long_print) | 71 '\n' |
| 72 '3 FAILED TESTS') |
| 73 self.assertEqual(gtest_print, self.tr.GetGtestForm()) |
72 | 74 |
73 def testRunPassed(self): | 75 def testRunPassed(self): |
74 self.assertFalse(self.tr.DidRunPass()) | 76 self.assertFalse(self.tr.DidRunPass()) |
75 tr2 = TestRunResults() | 77 tr2 = TestRunResults() |
76 self.assertTrue(tr2.DidRunPass()) | 78 self.assertTrue(tr2.DidRunPass()) |
77 | 79 |
78 | 80 |
79 if __name__ == '__main__': | 81 if __name__ == '__main__': |
80 unittest.main() | 82 unittest.main() |
OLD | NEW |