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

Side by Side Diff: scripts/common/unittests/gtest_utils_test.py

Issue 109223007: GTTF: Make runtest.py use the new test launcher's JSON summary. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build/
Patch Set: Created 7 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « scripts/common/gtest_utils.py ('k') | scripts/slave/runtest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Unit tests for classes in gtest_command.py.""" 6 """Unit tests for classes in gtest_command.py."""
7 7
8 import unittest 8 import unittest
9 9
10 import test_env # pylint: disable=W0611 10 import test_env # pylint: disable=W0611
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 ], 631 ],
632 parser.FailureDescription('PickleTest.EncodeDecode')) 632 parser.FailureDescription('PickleTest.EncodeDecode'))
633 633
634 def testNestedGtests(self): 634 def testNestedGtests(self):
635 parser = gtest_utils.GTestLogParser() 635 parser = gtest_utils.GTestLogParser()
636 for line in TEST_DATA_NESTED_RUNS.splitlines(): 636 for line in TEST_DATA_NESTED_RUNS.splitlines():
637 parser.ProcessLine(line) 637 parser.ProcessLine(line)
638 self.assertEqual(['Foo.Bar'], parser.FailedTests(True, True)) 638 self.assertEqual(['Foo.Bar'], parser.FailedTests(True, True))
639 639
640 640
641 class TestGTestJSONParserTests(unittest.TestCase):
642 def testPassedTests(self):
643 parser = gtest_utils.GTestJSONParser()
644 parser._ProcessJSONData({'per_iteration_data': [ # pylint: disable=W0212
645 {
646 'Test.One': [{'status': 'SUCCESS', 'output_snippet': ''}],
647 'Test.Two': [{'status': 'SUCCESS', 'output_snippet': ''}],
648 }
649 ]})
650
651 self.assertEqual(['Test.One', 'Test.Two'], parser.PassedTests())
652 self.assertEqual([], parser.FailedTests())
653 self.assertEqual(0, parser.FlakyTests())
654
655 def testFailedTests(self):
656 parser = gtest_utils.GTestJSONParser()
657 parser._ProcessJSONData({'per_iteration_data': [ # pylint: disable=W0212
658 {
659 'Test.One': [{'status': 'FAILURE', 'output_snippet': ''}],
660 'Test.Two': [{'status': 'FAILURE', 'output_snippet': ''}],
661 }
662 ]})
663
664 self.assertEqual([], parser.PassedTests())
665 self.assertEqual(['Test.One', 'Test.Two'], parser.FailedTests())
666 self.assertEqual(0, parser.FlakyTests())
667
668 def testFlakyTests(self):
669 parser = gtest_utils.GTestJSONParser()
670 parser._ProcessJSONData({'per_iteration_data': [ # pylint: disable=W0212
671 {
672 'Test.One': [{'status': 'FAILURE', 'output_snippet': ''}],
673 'Test.Two': [
674 {'status': 'FAILURE', 'output_snippet': ''},
675 {'status': 'SUCCESS', 'output_snippet': ''},
676 ],
677 }
678 ]})
679
680 self.assertEqual(['Test.Two'], parser.PassedTests())
681 self.assertEqual(['Test.One'], parser.FailedTests())
682 self.assertEqual(1, parser.FlakyTests())
683
684
641 if __name__ == '__main__': 685 if __name__ == '__main__':
642 unittest.main() 686 unittest.main()
OLDNEW
« no previous file with comments | « scripts/common/gtest_utils.py ('k') | scripts/slave/runtest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698