summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorgan Richomme <morgan.richomme@orange.com>2017-06-15 01:49:03 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-06-15 01:49:03 +0000
commit644d4c54bab9939da3ef2b1655092c7e4981f57d (patch)
treeaa77fc5c8a5eb5b847ec390ce3d25f5b8ea210fa
parent6049af70807987e124ba0cf4f05ee16fe89b88db (diff)
parent088ac89c10a1a69fdb14dc13280dacd2830a7d29 (diff)
Merge "Update Suite details pushed to DB"
-rw-r--r--functest/core/unit.py7
-rw-r--r--functest/tests/unit/core/test_unit.py12
2 files changed, 13 insertions, 6 deletions
diff --git a/functest/core/unit.py b/functest/core/unit.py
index 515a20806..61b5a58d9 100644
--- a/functest/core/unit.py
+++ b/functest/core/unit.py
@@ -74,8 +74,11 @@ class Suite(testcase.TestCase):
stream=stream, verbosity=2).run(self.suite)
self.__logger.debug("\n\n%s", stream.getvalue())
self.stop_time = time.time()
- self.details = {"failures": result.failures,
- "errors": result.errors}
+ self.details = {
+ "testsRun": result.testsRun,
+ "failures": len(result.failures),
+ "errors": len(result.errors),
+ "stream": stream.getvalue()}
self.result = 100 * (
(result.testsRun - (len(result.failures) +
len(result.errors))) /
diff --git a/functest/tests/unit/core/test_unit.py b/functest/tests/unit/core/test_unit.py
index 79c4e7d7a..ca73de672 100644
--- a/functest/tests/unit/core/test_unit.py
+++ b/functest/tests/unit/core/test_unit.py
@@ -41,7 +41,9 @@ class PyTestSuiteRunnerTesting(unittest.TestCase):
self._test_run(result=mock_result,
status=testcase.TestCase.EX_RUN_ERROR)
self.assertEqual(self.psrunner.result, 0)
- self.assertEqual(self.psrunner.details, {'errors': [], 'failures': []})
+ self.assertEqual(self.psrunner.details,
+ {'errors': 0, 'failures': 0, 'stream': '',
+ 'testsRun': 0})
self.assertEqual(self.psrunner.is_successful(),
testcase.TestCase.EX_TESTCASE_FAILED)
@@ -52,8 +54,8 @@ class PyTestSuiteRunnerTesting(unittest.TestCase):
self._test_run(result=mock_result)
self.assertEqual(self.psrunner.result, 96)
self.assertEqual(self.psrunner.details,
- {'errors': [('test1', 'error_msg1')],
- 'failures': [('test2', 'failure_msg1')]})
+ {'errors': 1, 'failures': 1, 'stream': '',
+ 'testsRun': 50})
self.assertEqual(self.psrunner.is_successful(),
testcase.TestCase.EX_TESTCASE_FAILED)
@@ -62,7 +64,9 @@ class PyTestSuiteRunnerTesting(unittest.TestCase):
failures=[])
self._test_run(result=mock_result)
self.assertEqual(self.psrunner.result, 100)
- self.assertEqual(self.psrunner.details, {'errors': [], 'failures': []})
+ self.assertEqual(self.psrunner.details,
+ {'errors': 0, 'failures': 0, 'stream': '',
+ 'testsRun': 50})
self.assertEqual(self.psrunner.is_successful(),
testcase.TestCase.EX_OK)