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/agl_test_report.py | |
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/agl_test_report.py')
-rw-r--r-- | plugins/agl_test_report.py | 35 |
1 files changed, 15 insertions, 20 deletions
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> |