From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 993CB271 for ; Wed, 28 Jun 2017 07:58:14 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Jun 2017 22:58:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,274,1496127600"; d="scan'208";a="1187802733" Received: from unknown (HELO dpdk-fedora20.icx.intel.com) ([10.240.176.135]) by fmsmga002.fm.intel.com with ESMTP; 27 Jun 2017 22:58:13 -0700 From: "xu,huilong" To: dts@dpdk.org Cc: "xu,huilong" Date: Wed, 28 Jun 2017 13:59:30 +0800 Message-Id: <1498629570-20724-3-git-send-email-huilongx.xu@intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1498629570-20724-1-git-send-email-huilongx.xu@intel.com> References: <1498629570-20724-1-git-send-email-huilongx.xu@intel.com> Subject: [dts] [PATCH V2 3/3] update case result write function X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jun 2017 05:58:15 -0000 update case result write function, all same case only have one test result if one time case test result passed, this result will passed and save in excel file. if all times case test result failed, this resulr will failed and save in excel file. Signed-off-by: xu,huilong --- framework/excel_reporter.py | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/framework/excel_reporter.py b/framework/excel_reporter.py index 2030d87..5b8e4cf 100644 --- a/framework/excel_reporter.py +++ b/framework/excel_reporter.py @@ -142,9 +142,23 @@ class ExcelReporter(object): self.title_style = xlwt.XFStyle() self.title_style.font = title_font - - def __write_result(self, dut, target, suite, case): - test_result = self.result.result_for(dut, target, suite, case) + + def __get_case_result(self, dut, target, suite, case): + case_list = self.result.all_test_cases(dut, target, suite) + if case_list.count(case) > 1: + tmp_result = [] + for case_name in case_list: + if case == case_name: + test_result = self.result.result_for(dut, target, suite, case) + if 'PASSED' in test_result: + return ['PASSED', ''] + else: + tmp_result.append(test_result) + return tmp_result[-1] + else: + return self.result.result_for(dut, target, suite, case) + + def __write_result(self, dut, target, suite, case, test_result): if test_result is not None and len(test_result) > 0: result = test_result[0] if test_result[1] != '': @@ -156,13 +170,14 @@ class ExcelReporter(object): self.row, self.col + 1, result, self.failed_style) def __write_cases(self, dut, target, suite): - for case in self.result.all_test_cases(dut, target, suite): + for case in set(self.result.all_test_cases(dut, target, suite)): + result = self.__get_case_result(dut, target, suite, case) self.col += 1 if case[:5] == "test_": self.sheet.write(self.row, self.col, case[5:]) else: self.sheet.write(self.row, self.col, case) - self.__write_result(dut, target, suite, case) + self.__write_result(dut, target, suite, case, result) self.row += 1 self.col -= 1 -- 1.9.3