| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 import unittest | 5 import unittest |
| 6 | 6 |
| 7 from model.wf_swarming_task import WfSwarmingTask | 7 from model.wf_swarming_task import WfSwarmingTask |
| 8 | 8 |
| 9 | 9 |
| 10 class WfSwarmingTaskTest(unittest.TestCase): | 10 class WfSwarmingTaskTest(unittest.TestCase): |
| 11 def testClassifiedTests(self): | 11 def testClassifiedTests(self): |
| 12 task = WfSwarmingTask.Create('m', 'b', 121, 'browser_tests') | 12 task = WfSwarmingTask.Create('m', 'b', 121, 'browser_tests') |
| 13 task.tests_statuses = { | 13 task.tests_statuses = { |
| 14 'TestSuite1.test1': { | 14 'TestSuite1.test1': { |
| 15 'total_run': 2, | 15 'total_run': 2, |
| 16 'SUCCESS': 2 | 16 'SUCCESS': 2 |
| 17 }, | 17 }, |
| 18 'TestSuite1.test2': { | 18 'TestSuite1.test2': { |
| 19 'total_run': 4, | 19 'total_run': 4, |
| 20 'SUCCESS': 2, | 20 'SUCCESS': 2, |
| 21 'FAILURE': 2 | 21 'FAILURE': 2 |
| 22 }, | 22 }, |
| 23 'TestSuite1.test3': { | 23 'TestSuite1.test3': { |
| 24 'total_run': 6, | 24 'total_run': 6, |
| 25 'FAILURE': 6 | 25 'FAILURE': 6 |
| 26 }, |
| 27 'TestSuite1.test4': { |
| 28 'total_run': 6, |
| 29 'SKIPPED': 6 |
| 30 }, |
| 31 'TestSuite1.test5': { |
| 32 'total_run': 6, |
| 33 'UNKNOWN': 6 |
| 26 } | 34 } |
| 27 } | 35 } |
| 28 | 36 |
| 29 expected_classified_tests = { | 37 expected_classified_tests = { |
| 30 'flaky_tests': ['TestSuite1.test2', 'TestSuite1.test1'], | 38 'flaky_tests': ['TestSuite1.test2', 'TestSuite1.test1'], |
| 31 'reliable_tests': ['TestSuite1.test3'] | 39 'reliable_tests': ['TestSuite1.test3', 'TestSuite1.test4'], |
| 40 'unknown_tests': ['TestSuite1.test5'] |
| 32 } | 41 } |
| 33 | 42 |
| 34 self.assertEqual(expected_classified_tests, task.classified_tests) | 43 self.assertEqual(expected_classified_tests, task.classified_tests) |
| OLD | NEW |