summaryrefslogtreecommitdiffstats
path: root/dovetail/testcase.py
diff options
context:
space:
mode:
authorLeo Wang <grakiss.wanglei@huawei.com>2016-12-21 02:34:44 -0500
committerLeo wang <grakiss.wanglei@huawei.com>2016-12-22 02:14:26 +0000
commit76be7f7c6b2921aad6a68504a2020fb032eb5fde (patch)
treed46b86eff31cd11fc50b6cdc9f45965e14a919b8 /dovetail/testcase.py
parent1124a453feb24308f58bda363c229f632cafd82f (diff)
[dovetail tool]check and get results for each cmd
JIRA: DOVETAIL-166 Check the results of each cmds executed in test case 1. the results of pre_condition, post_condition, cmds need to be checked, so it can get a quick fail, dont need to go through the next step 2. it's more accurate to show where error occurred as early as possible 3. get results from shell scripts Change-Id: I5c1e59839c55b92de0e83e7e1eb552aa364b3f80 Signed-off-by: Leo Wang <grakiss.wanglei@huawei.com>
Diffstat (limited to 'dovetail/testcase.py')
-rw-r--r--dovetail/testcase.py30
1 files changed, 23 insertions, 7 deletions
diff --git a/dovetail/testcase.py b/dovetail/testcase.py
index dd0fd2b5..040c6f98 100644
--- a/dovetail/testcase.py
+++ b/dovetail/testcase.py
@@ -93,17 +93,33 @@ class Testcase(object):
return self._result_acquired(self.validate_testcase(), acquired)
def pre_condition(self):
- return self.pre_condition_cls(self.validate_type())
+ try:
+ pre_condition = self.testcase['validate']['pre_condition']
+ if pre_condition == '':
+ pre_condition = self.pre_condition_cls(self.validate_type())
+ return pre_condition
+ except:
+ self.logger.debug('testcase:%s pre_condition is empty',
+ self.name())
+ return ''
def post_condition(self):
- return self.post_condition_cls(self.validate_type())
+ try:
+ post_condition = self.testcase['validate']['post_condition']
+ if post_condition == '':
+ post_condition = self.post_condition_cls(self.validate_type())
+ return post_condition
+ except:
+ self.logger.debug('testcae:%s post_condition is empty',
+ self.name())
+ return ''
def run(self):
runner = TestRunnerFactory.create(self)
try:
runner.run()
- except AttributeError:
- pass
+ except AttributeError as e:
+ self.logger.exception('testcase:%s except:%s', self.name, e)
# testcase in upstream testing project
# validate_testcase_list = {'functest': {}, 'yardstick': {}, 'shell': {}}
@@ -187,7 +203,7 @@ class FunctestTestcase(Testcase):
def __init__(self, testcase_yaml):
super(FunctestTestcase, self).__init__(testcase_yaml)
- self.name = 'functest'
+ self.type = 'functest'
def prepare_cmd(self):
ret = super(FunctestTestcase, self).prepare_cmd()
@@ -208,7 +224,7 @@ class YardstickTestcase(Testcase):
def __init__(self, testcase_yaml):
super(YardstickTestcase, self).__init__(testcase_yaml)
- self.name = 'yardstick'
+ self.type = 'yardstick'
class ShellTestcase(Testcase):
@@ -217,7 +233,7 @@ class ShellTestcase(Testcase):
def __init__(self, testcase_yaml):
super(ShellTestcase, self).__init__(testcase_yaml)
- self.name = 'shell'
+ self.type = 'shell'
class TestcaseFactory(object):