test suite reviews and discussions
 help / color / mirror / Atom feed
From: "xu,huilong" <huilongx.xu@intel.com>
To: dts@dpdk.org
Cc: "xu,huilong" <huilongx.xu@intel.com>
Subject: [dts] [PATCH V2 3/3] update case result write function
Date: Wed, 28 Jun 2017 13:59:30 +0800	[thread overview]
Message-ID: <1498629570-20724-3-git-send-email-huilongx.xu@intel.com> (raw)
In-Reply-To: <1498629570-20724-1-git-send-email-huilongx.xu@intel.com>

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 <huilongx.xu@intel.com>
---
 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

      parent reply	other threads:[~2017-06-28  5:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-28  5:59 [dts] [PATCH V2 1/3] add re_run parameter xu,huilong
2017-06-28  5:59 ` [dts] [PATCH V2 2/3] update exec case function xu,huilong
2017-06-28  5:59 ` xu,huilong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1498629570-20724-3-git-send-email-huilongx.xu@intel.com \
    --to=huilongx.xu@intel.com \
    --cc=dts@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).