From: Morgan Richomme Date: Wed, 10 May 2017 07:54:08 +0000 (+0000) Subject: Merge "Conform ODL with last framework updates" X-Git-Tag: opnfv-5.0.RC1~423 X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=5b536321b8722f87715cab7bae3f6813bb73fd2a;p=functest.git Merge "Conform ODL with last framework updates" --- 5b536321b8722f87715cab7bae3f6813bb73fd2a diff --cc functest/core/testcase.py index b220a587d,b993183cc..49fae6097 --- a/functest/core/testcase.py +++ b/functest/core/testcase.py @@@ -39,25 -39,10 +39,25 @@@ class TestCase(object) self.project_name = kwargs.get('project_name', 'functest') self.case_name = kwargs.get('case_name', '') self.criteria = kwargs.get('criteria', 100) - self.result = "" - self.start_time = "" - self.stop_time = "" + self.result = 0 + self.start_time = 0 + self.stop_time = 0 + def __str__(self): + try: + assert self.project_name + assert self.case_name + result = 'PASS' if(self.is_successful( + ) == TestCase.EX_OK) else 'FAIL' + return ('| {0:<23} | {1:<13} | {2:<10} | {3:<13} |' + '\n{4:-<26}{4:-<16}{4:-<13}{4:-<16}{4}'.format( + self.case_name, self.project_name, + self.get_duration(), result, '+')) + except AssertionError: + self.__logger.error("We cannot print invalid objects") + return '| {0:^68} |\n{1:-<26}{1:-<16}{1:-<13}{1:-<16}{1}'.format( + 'INVALID OBJECT', '+') + def get_duration(self): """Return the duration of the test case.