From 0bc4ce082bf7ec59dd371ba81d040ebad7b090fd Mon Sep 17 00:00:00 2001 From: pmikus Date: Tue, 16 Aug 2016 08:08:49 +0100 Subject: [PATCH] CSIT-358 Improve robot output parser - Improve the output from robot parser script Change-Id: Id81bb7891564d1466431e565f7ce19d1dbbf7caa Signed-off-by: pmikus --- resources/tools/robot_output_parser_publish.py | 31 +++++++++++++++++++------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/resources/tools/robot_output_parser_publish.py b/resources/tools/robot_output_parser_publish.py index f9eab8ce08..92038b5903 100755 --- a/resources/tools/robot_output_parser_publish.py +++ b/resources/tools/robot_output_parser_publish.py @@ -18,6 +18,7 @@ robot framework output file (output.xml) and print in specified format (wiki, html) to stdout or, if specified by parameter, redirect to file.""" import argparse +import re import sys from robot.api import ExecutionResult, ResultVisitor @@ -40,14 +41,20 @@ class ExecutionChecker(ResultVisitor): if self.start_suite(suite) is not False: if suite.tests: if self.formatting == 'html': - sys.stdout.write(''+'\n') - sys.stdout.write(''+\ - ''+\ - ''+\ - ''+'\n') + sys.stdout.write('
NameDocumentationMessageStatus
'+'\n') + sys.stdout.write(''+'\n') + sys.stdout.write(''+'\n') + if "Perf" and "Long" in suite.longname: + sys.stdout.write(''+'\n') + sys.stdout.write(''+'\n') + sys.stdout.write('') elif self.formatting == 'wiki': sys.stdout.write('{| class="wikitable"'+'\n') - sys.stdout.write('!Name!!Documentation!!Message!!Status'+'\n') + if "Perf" and "Long" in suite.longname: + header = '!Name!!Documentation!!Message!!Status' + else: + header = '!Name!!Documentation!!Status' + sys.stdout.write(header+'\n') else: pass @@ -78,9 +85,15 @@ class ExecutionChecker(ResultVisitor): mark_l = '' mark_r = '' sys.stdout.write(mark_l+suite.name+mark_r+'\n') + sys.stdout.write('

'+re.sub(r"(\*)(.*?)(\*)", r"\2",\ + suite.doc, 0, flags=re.MULTILINE).replace(\ + '[', '
[')+'

\n') + elif self.formatting == 'wiki': mark = "=" * (level+2) sys.stdout.write(mark+suite.name+mark+'\n') + sys.stdout.write(re.sub(r"(\*)(.*?)(\*)", r"\n*'''\2'''",\ + suite.doc.replace('\n', ' '), 0, flags=re.MULTILINE)+'\n') else: pass @@ -117,13 +130,15 @@ class ExecutionChecker(ResultVisitor): sys.stdout.write(''+'\n') sys.stdout.write(''+'\n') sys.stdout.write(''+'\n') - sys.stdout.write(''+'\n') + if any("PERFTEST_LONG" in tag for tag in test.tags): + sys.stdout.write(''+'\n') sys.stdout.write(''+'\n') elif self.formatting == 'wiki': sys.stdout.write('|-'+'\n') sys.stdout.write('|'+test.name+'\n') sys.stdout.write('|'+test.doc+'\n') - sys.stdout.write('|'+test.message+'\n') + if any("PERFTEST_LONG" in tag for tag in test.tags): + sys.stdout.write('|'+test.message+'\n') sys.stdout.write('|'+test.status+'\n') else: pass -- 2.16.6
NameDocumentationMessageStatus
'+test.name+''+test.doc+''+test.message+''+test.message+''+test.status+'