aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorduerpei <duep.fnst@fujitsu.com>2022-09-03 15:48:31 +0800
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2022-12-08 05:59:37 +0000
commit39b04de14116e2a681dc6bad474dc76620d2de57 (patch)
tree634a47628bfbe355e658aa27e73972adfdf73750
parent85e3c12681faca0519ca995a82feeb7709397ca2 (diff)
agl-test-framework: add "XPASS" and "XFAIL" states
Adjust the test framework , add "XPASS" and "XFAIL" states for the result of test case, and delete useless code by the way. Bug-AGL: SPEC-4345 Signed-off-by: duerpei <duep.fnst@fujitsu.com> Change-Id: I5763dc27caef956fb6632fcb59d9f95d671f4766
-rw-r--r--conftest.py10
-rw-r--r--plugins/agl_test_base.py1
-rw-r--r--plugins/agl_test_ptest_base.py19
-rw-r--r--plugins/agl_test_report.py35
-rw-r--r--template/summary_result_tpl.html2
5 files changed, 35 insertions, 32 deletions
diff --git a/conftest.py b/conftest.py
index 5dea9a4..512c1ba 100644
--- a/conftest.py
+++ b/conftest.py
@@ -75,10 +75,12 @@ def get_summary_data(report_files):
with open(report_json,'r') as f:
data = json.load(f)
- total = passed = failed = skipped = 0
+ total = passed = xpassed = failed = xfailed = skipped = 0
total = data["collected"]
passed = data["passed"]
+ xpassed = data["xpassed"]
failed = data["failed"]
+ xfailed = data["xfailed"]
skipped = data["skipped"]
test_status = data["test_status"]
test_name = data["test_name"]
@@ -86,7 +88,9 @@ def get_summary_data(report_files):
this_summary = {
'total': total,
'passed': passed,
+ 'xpassed': xpassed,
'failed': failed,
+ 'xfailed': xfailed,
'skipped': skipped,
'test_status': test_status,
}
@@ -139,7 +143,9 @@ def get_summary_report_html(summary_data,zip_name):
html = html + "<th><font color = \"white\">test suite</font></th>"
html = html + "<th><font color = \"white\">status</font></th>"
html = html + "<th><font color = \"white\">pass</font></th>"
+ html = html + "<th><font color = \"white\">xpass</font></th>"
html = html + "<th><font color = \"white\">fail</font></th>"
+ html = html + "<th><font color = \"white\">xfail</font></th>"
html = html + "<th><font color = \"white\">skip</font></th>"
html = html + "</tr>"
@@ -157,7 +163,9 @@ def get_summary_report_html(summary_data,zip_name):
html = html + "<th>" + test_suite + "</th>"
html = html + "<th>" + summary_data[test_suite]["test_status"] + "</th>"
html = html + "<th>" + str(summary_data[test_suite]["passed"]) + "</th>"
+ html = html + "<th>" + str(summary_data[test_suite]["xpassed"]) + "</th>"
html = html + "<th>" + str(summary_data[test_suite]["failed"]) + "</th>"
+ html = html + "<th>" + str(summary_data[test_suite]["xfailed"]) + "</th>"
html = html + "<th>" + str(summary_data[test_suite]["skipped"]) + "</th>"
html = html + "</tr>"
diff --git a/plugins/agl_test_base.py b/plugins/agl_test_base.py
index bd39335..a6bcff9 100644
--- a/plugins/agl_test_base.py
+++ b/plugins/agl_test_base.py
@@ -47,7 +47,6 @@ class AGLBaseTest:
def log_process(self):
logfile = self.get_logfile()
self.case_info_list = log.log_process(logfile)
- self.init_case_status()
def init_case_status(self):
for key in self.case_info_list:
diff --git a/plugins/agl_test_ptest_base.py b/plugins/agl_test_ptest_base.py
index 89eb554..4e261bc 100644
--- a/plugins/agl_test_ptest_base.py
+++ b/plugins/agl_test_ptest_base.py
@@ -19,17 +19,18 @@ class PTESTBase(AGLBaseTest):
def run_case(self, case_id):
case_info = self.get_caseinfo_by_name(case_id)
- if (case_info[1] == "PASS"):
- case_info[2] = "passed"
- elif (case_info[1] == "FAIL"):
- case_info[2] = "failed"
- elif (case_info[1] == "SKIP"):
- case_info[2] = "skipped"
- else:
- case_info[2] = "failed"
+ if (case_info[2] == ""):
+ if (case_info[1] == "PASS"):
+ case_info[2] = "passed"
+ elif (case_info[1] == "FAIL"):
+ case_info[2] = "failed"
+ elif (case_info[1] == "SKIP"):
+ case_info[2] = "skipped"
+ else:
+ case_info[2] = "failed"
self.update_caseinfo_by_name(case_id, case_info)
- assert case_info[2] == "passed" or case_info[2] == "skipped"
+ assert case_info[2] == "passed" or case_info[2] == "skipped" or case_info[2] == "xpassed"
def precheck(self):
# check for common
diff --git a/plugins/agl_test_report.py b/plugins/agl_test_report.py
index 958fe29..5896722 100644
--- a/plugins/agl_test_report.py
+++ b/plugins/agl_test_report.py
@@ -41,21 +41,6 @@ def format_caselist(case_info_list: dict):
case_status[key] = case_info[2]
return case_status
-#Case_status is a dictionary type of data,Record the test name/id and final results of all test cases
-#Get the summary of the test case status, the result is like that:
-#Summary = [["collected",3],["passed",3],["failed",0],["skipped",0]]
-def get_summary(case_status):
- collected_num = passed_num = failed_num = skipped_num = 0
- collected_num = len(case_status)
- for status in case_status.values():
- if (status == "passed"):
- passed_num = passed_num + 1
- elif (status == "failed"):
- failed_num = failed_num + 1
- else:
- skipped_num = skipped_num + 1
- summary = [["collected",collected_num],["passed",passed_num],["failed",failed_num],["skipped",skipped_num]]
- return summary
#Input format
# {
@@ -70,20 +55,26 @@ def get_summary(case_status):
# 'skipped": skipped_num
# }
def format_summary(case_info_list):
- collected_num = passed_num = failed_num = skipped_num = 0
+ collected_num = passed_num = xpassed_num = failed_num = xfailed_num = skipped_num = 0
for key in case_info_list:
case_info = case_info_list[key]
collected_num = collected_num + 1
if (case_info[2] == "passed"):
passed_num = passed_num + 1
+ elif (case_info[2] == "xpassed"):
+ xpassed_num = xpassed_num + 1
elif (case_info[2] == "failed"):
failed_num = failed_num + 1
+ elif (case_info[2] == "xfailed"):
+ xfailed_num = xfailed_num + 1
else:
skipped_num = skipped_num + 1
summary = dict()
summary["collected"] = collected_num
summary["passed"] = passed_num
+ summary["xpassed"] = xpassed_num
summary["failed"] = failed_num
+ summary["xfailed"] = xfailed_num
summary["skipped"] = skipped_num
return summary
@@ -102,8 +93,10 @@ def write_data_to_json(THIS_TEST,test_set_status,summary,case_status):
'test_name': THIS_TEST,
'collected': summary[0][1],
'passed': summary[1][1],
- 'failed': summary[2][1],
- 'skipped': summary[3][1],
+ 'xpassed': summary[2][1],
+ 'failed': summary[3][1],
+ 'xfailed': summary[4][1],
+ 'skipped': summary[5][1],
'case_status': case_status
}
@@ -126,8 +119,10 @@ def get_report_html(THIS_TEST,test_set_status,summary,case_status):
html = html + "<p>" + "Status :" + test_set_status + "</p>"
html = html + "<p>" + "Total: " + str(summary[0][1])
html = html + " Pass: " + str(summary[1][1])
- html = html + " Fail: " + str(summary[2][1])
- html = html + " Skip: " + str(summary[3][1]) + "</p>"
+ html = html + " Xpass: " + str(summary[2][1])
+ html = html + " Fail: " + str(summary[3][1])
+ html = html + " Xfail: " + str(summary[4][1])
+ html = html + " Skip: " + str(summary[5][1]) + "</p>"
html = html + "<p>Details : </p>"
#<table> </table>
diff --git a/template/summary_result_tpl.html b/template/summary_result_tpl.html
index 6b8f9fe..6b173cf 100644
--- a/template/summary_result_tpl.html
+++ b/template/summary_result_tpl.html
@@ -6,7 +6,7 @@
<body>
<h1> {{ data.test_name }} test report </h1>
<li> Status : {{ data.test_status }} </li>
- <li> Total : {{ data.collected }} Pass : {{ data.passed }} Fail : {{ data.failed }} Skip : {{ data.skipped }} </li>
+ <li> Total : {{ data.collected }} Pass : {{ data.passed }} Xpass : {{ data.xpassed }} Fail : {{ data.failed }} Xfail : {{ data.xfailed }} Skip : {{ data.skipped }} </li>
<li> Details : </li>
<table border="1" cellspacing="2">
{{ data.case_status_html }}