aboutsummaryrefslogtreecommitdiffstats
path: root/functest/core/testcase_base.py
diff options
context:
space:
mode:
authorJose Lausuch <jose.lausuch@ericsson.com>2016-12-16 09:58:00 +0000
committerGerrit Code Review <gerrit@opnfv.org>2016-12-16 09:58:00 +0000
commit9251dcc0c689edc182ab7ae5a7fabc7da6544eca (patch)
treedf71e10ea2613fd904a89a7577bbf809ef35d47f /functest/core/testcase_base.py
parente9062a334bf73c19f3de74465209eaf099c46a26 (diff)
parent0d875d44c3d67e049c165365add1084467143b62 (diff)
Merge "Add check_criteria() in testcase_base"
Diffstat (limited to 'functest/core/testcase_base.py')
-rw-r--r--functest/core/testcase_base.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/functest/core/testcase_base.py b/functest/core/testcase_base.py
index e869803d..838b6398 100644
--- a/functest/core/testcase_base.py
+++ b/functest/core/testcase_base.py
@@ -18,6 +18,7 @@ class TestcaseBase(object):
EX_OK = os.EX_OK
EX_RUN_ERROR = os.EX_SOFTWARE
EX_PUSH_TO_DB_ERROR = os.EX_SOFTWARE - 1
+ EX_TESTCASE_FAILED = os.EX_SOFTWARE - 2
logger = ft_logger.Logger(__name__).getLogger()
@@ -29,6 +30,15 @@ class TestcaseBase(object):
self.start_time = ""
self.stop_time = ""
+ def check_criteria(self):
+ try:
+ assert self.criteria
+ if self.criteria == 'PASS':
+ return TestcaseBase.EX_OK
+ except:
+ self.logger.error("Please run test before checking the results")
+ return TestcaseBase.EX_TESTCASE_FAILED
+
def run(self, **kwargs):
self.logger.error("Run must be implemented")
return TestcaseBase.EX_RUN_ERROR