aboutsummaryrefslogtreecommitdiffstats
path: root/xtesting/core/behaveframework.py
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2020-01-04 16:30:07 +0100
committerCédric Ollivier <cedric.ollivier@orange.com>2020-01-04 16:52:51 +0100
commite2d3d12e4061c414e8cfda55fb2285243188a264 (patch)
tree5311ab73cd8afb7dc673e339fa06a03e7ab43a25 /xtesting/core/behaveframework.py
parentc8718e76153c4109bd7232508f64d46c923f6282 (diff)
Fix behave driver and its related unit tests
Change-Id: I466d655162c1ddd5f4e3ef0e356a27007bfaea0f Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com> (cherry picked from commit b2c3ee8560d3f98f668007c1bcb55b6194e631c4)
Diffstat (limited to 'xtesting/core/behaveframework.py')
-rw-r--r--xtesting/core/behaveframework.py29
1 files changed, 8 insertions, 21 deletions
diff --git a/xtesting/core/behaveframework.py b/xtesting/core/behaveframework.py
index ede3883f..2b41614c 100644
--- a/xtesting/core/behaveframework.py
+++ b/xtesting/core/behaveframework.py
@@ -43,14 +43,8 @@ class BehaveFramework(testcase.TestCase):
def parse_results(self):
"""Parse output.json and get the details in it."""
-
- try:
- with open(self.json_file) as stream_:
- self.response = json.load(stream_)
- except IOError:
- self.__logger.error("Error reading the file %s", self.json_file)
-
- try:
+ with open(self.json_file) as stream_:
+ self.response = json.load(stream_)
if self.response:
self.total_tests = len(self.response)
for item in self.response:
@@ -60,21 +54,14 @@ class BehaveFramework(testcase.TestCase):
self.fail_tests += 1
elif item['status'] == 'skipped':
self.skip_tests += 1
- except KeyError:
- self.__logger.error("Error in json - %s", self.response)
-
- try:
self.result = 100 * (
self.pass_tests / self.total_tests)
- except ZeroDivisionError:
- self.__logger.error("No test has been run")
-
- self.details = {}
- self.details['total_tests'] = self.total_tests
- self.details['pass_tests'] = self.pass_tests
- self.details['fail_tests'] = self.fail_tests
- self.details['skip_tests'] = self.skip_tests
- self.details['tests'] = self.response
+ self.details = {}
+ self.details['total_tests'] = self.total_tests
+ self.details['pass_tests'] = self.pass_tests
+ self.details['fail_tests'] = self.fail_tests
+ self.details['skip_tests'] = self.skip_tests
+ self.details['tests'] = self.response
def run(self, **kwargs):
"""Run the BehaveFramework feature files