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 base_test_result import BaseTestResult | 9 from base_test_result import BaseTestResult |
10 from base_test_result import TestRunResults | 10 from base_test_result import TestRunResults |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 tr2.AddResult(f2) | 46 tr2.AddResult(f2) |
47 tr2.AddTestRunResults(self.tr) | 47 tr2.AddTestRunResults(self.tr) |
48 self.assertFalse( | 48 self.assertFalse( |
49 tr2.GetAll().symmetric_difference( | 49 tr2.GetAll().symmetric_difference( |
50 [self.p1, self.p2, self.f1, self.c1, self.u1, f2])) | 50 [self.p1, self.p2, self.f1, self.c1, self.u1, f2])) |
51 | 51 |
52 def testGetLogs(self): | 52 def testGetLogs(self): |
53 log_print = ('[FAIL] f1:\n' | 53 log_print = ('[FAIL] f1:\n' |
54 'failure1\n' | 54 'failure1\n' |
55 '[CRASH] c1:\n' | 55 '[CRASH] c1:\n' |
56 'crash1\n' | 56 'crash1') |
57 '[UNKNOWN] u1:\n') | |
58 self.assertEqual(self.tr.GetLogs(), log_print) | 57 self.assertEqual(self.tr.GetLogs(), log_print) |
59 | 58 |
60 def testGetShortForm(self): | 59 def testGetShortForm(self): |
61 short_print = ('ALL: 5 PASS: 2 FAIL: 1 ' | 60 short_print = ('ALL: 5 PASS: 2 FAIL: 1 ' |
62 'CRASH: 1 TIMEOUT: 0 UNKNOWN: 1 ') | 61 'CRASH: 1 TIMEOUT: 0 UNKNOWN: 1 ') |
63 self.assertEqual(self.tr.GetShortForm(), short_print) | 62 self.assertEqual(self.tr.GetShortForm(), short_print) |
64 | 63 |
65 def testGetLongForm(self): | 64 def testGetLongForm(self): |
66 long_print = ('ALL (5 tests)\n' | 65 long_print = ('ALL (5 tests)\n' |
67 'PASS (2 tests)\n' | 66 'PASS (2 tests)\n' |
68 'FAIL (1 tests): [f1]\n' | 67 'FAIL (1 tests): [f1]\n' |
69 'CRASH (1 tests): [c1]\n' | 68 'CRASH (1 tests): [c1]\n' |
70 'TIMEOUT (0 tests): []\n' | 69 'TIMEOUT (0 tests): []\n' |
71 'UNKNOWN (1 tests): [u1]') | 70 'UNKNOWN (1 tests): [u1]') |
72 self.assertEqual(self.tr.GetLongForm(), long_print) | 71 self.assertEqual(self.tr.GetLongForm(), long_print) |
73 | 72 |
74 def testRunPassed(self): | 73 def testRunPassed(self): |
75 self.assertFalse(self.tr.DidRunPass()) | 74 self.assertFalse(self.tr.DidRunPass()) |
76 tr2 = TestRunResults() | 75 tr2 = TestRunResults() |
77 self.assertTrue(tr2.DidRunPass()) | 76 self.assertTrue(tr2.DidRunPass()) |
78 | 77 |
79 | 78 |
80 if __name__ == '__main__': | 79 if __name__ == '__main__': |
81 unittest.main() | 80 unittest.main() |
OLD | NEW |