aboutsummaryrefslogtreecommitdiffstats
path: root/utils/functest_utils.py
diff options
context:
space:
mode:
authorSerenaFeng <feng.xiaowei@zte.com.cn>2016-08-04 11:25:15 +0800
committerSerenaFeng <feng.xiaowei@zte.com.cn>2016-08-04 15:06:18 +0800
commit86195b92c29c2925529771d7a8014392e815f38c (patch)
treeb91d1adb50831959d02a15d1501decd40a9f17cf /utils/functest_utils.py
parent8f3ad08c40bd8977651794f6720eda5df61b0c26 (diff)
unify test result check for feature project and apply to parser
add check_test_result() method to unify test result process JIRA: FUNCTEST-405 Change-Id: Iee4d2876cbbf372f8c3e3bf94448036669bc7f7e Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'utils/functest_utils.py')
-rw-r--r--utils/functest_utils.py21
1 files changed, 19 insertions, 2 deletions
diff --git a/utils/functest_utils.py b/utils/functest_utils.py
index b0014308e..437315241 100644
--- a/utils/functest_utils.py
+++ b/utils/functest_utils.py
@@ -353,16 +353,33 @@ def check_success_rate(case_name, success_rate):
success_rate = float(success_rate)
criteria = get_criteria_by_test(case_name)
- def get_value(op):
+ def get_criteria_value(op):
return float(criteria.split(op)[1].rstrip('%'))
status = 'FAIL'
ops = ['==', '>=']
for op in ops:
if op in criteria:
- c_value = get_value(op)
+ c_value = get_criteria_value(op)
if eval("%s %s %s" % (success_rate, op, c_value)):
status = 'PASS'
break
return status
+
+
+def check_test_result(test_name, ret, start_time, stop_time):
+ def get_criteria_value():
+ return get_criteria_by_test(test_name).split('==')[1].strip()
+
+ status = 'FAIL'
+ if str(ret) == get_criteria_value():
+ status = 'PASS'
+
+ details = {
+ 'timestart': start_time,
+ 'duration': round(stop_time - start_time, 1),
+ 'status': status,
+ }
+
+ return status, details