diff options
author | duerpei <duep.fnst@fujitsu.com> | 2022-09-03 15:48:31 +0800 |
---|---|---|
committer | Jan-Simon Moeller <jsmoeller@linuxfoundation.org> | 2022-12-08 05:59:37 +0000 |
commit | 39b04de14116e2a681dc6bad474dc76620d2de57 (patch) | |
tree | 634a47628bfbe355e658aa27e73972adfdf73750 /plugins | |
parent | 85e3c12681faca0519ca995a82feeb7709397ca2 (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
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/agl_test_base.py | 1 | ||||
-rw-r--r-- | plugins/agl_test_ptest_base.py | 19 | ||||
-rw-r--r-- | plugins/agl_test_report.py | 35 |
3 files changed, 25 insertions, 30 deletions
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> |