diff options
author | Jose Lausuch <jose.lausuch@ericsson.com> | 2017-05-05 14:33:49 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-05-05 14:33:49 +0000 |
commit | 25e6056936b358d7556865deb8f3e86f63248efe (patch) | |
tree | 383caa032bc865e660c2181d10da3e29c852cb3e /functest/tests | |
parent | 6e4d097a8881fa0cfcc2c192639eb0f17ce025a2 (diff) | |
parent | ee26a1ca85fc5fac6df6c39f362fad83de73c0cc (diff) |
Merge "Print the real testcase duration"
Diffstat (limited to 'functest/tests')
-rw-r--r-- | functest/tests/unit/core/test_testcase.py | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/functest/tests/unit/core/test_testcase.py b/functest/tests/unit/core/test_testcase.py index cc8446d8..37948ee1 100644 --- a/functest/tests/unit/core/test_testcase.py +++ b/functest/tests/unit/core/test_testcase.py @@ -22,7 +22,7 @@ __author__ = "Cedric Ollivier <cedric.ollivier@orange.com>" class TestCaseTesting(unittest.TestCase): """The class testing TestCase.""" - # pylint: disable=missing-docstring + # pylint: disable=missing-docstring,too-many-public-methods logging.disable(logging.CRITICAL) @@ -162,6 +162,33 @@ class TestCaseTesting(unittest.TestCase): self.assertEqual(self.test.check_result(), testcase.TestCase.EX_TESTCASE_FAILED) + def test_get_duration_start_ko(self): + self.test.start_time = None + self.assertEqual(self.test.get_duration(), "XX:XX") + self.test.start_time = 0 + self.assertEqual(self.test.get_duration(), "XX:XX") + + def test_get_duration_end_ko(self): + self.test.stop_time = None + self.assertEqual(self.test.get_duration(), "XX:XX") + self.test.stop_time = 0 + self.assertEqual(self.test.get_duration(), "XX:XX") + + def test_get_invalid_duration(self): + self.test.start_time = 2 + self.test.stop_time = 1 + self.assertEqual(self.test.get_duration(), "XX:XX") + + def test_get_zero_duration(self): + self.test.start_time = 2 + self.test.stop_time = 2 + self.assertEqual(self.test.get_duration(), "00:00") + + def test_get_duration(self): + self.test.start_time = 1 + self.test.stop_time = 180 + self.assertEqual(self.test.get_duration(), "02:59") + if __name__ == "__main__": unittest.main(verbosity=2) |