diff options
author | pmikus <pmikus@cisco.com> | 2016-08-16 08:08:49 +0100 |
---|---|---|
committer | Miroslav Miklus <mmiklus@cisco.com> | 2016-08-26 12:03:44 +0000 |
commit | 0bc4ce082bf7ec59dd371ba81d040ebad7b090fd (patch) | |
tree | 0be0e66d3447763b12c42a7c9d0ae5d4bac6e176 /resources | |
parent | 539ee15f054aca7d1b84efe4de06e6930424c905 (diff) |
CSIT-358 Improve robot output parser
- Improve the output from robot parser script
Change-Id: Id81bb7891564d1466431e565f7ce19d1dbbf7caa
Signed-off-by: pmikus <pmikus@cisco.com>
Diffstat (limited to 'resources')
-rwxr-xr-x | resources/tools/robot_output_parser_publish.py | 31 |
1 files 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('<table border=1>'+'\n') - sys.stdout.write('<tr><th width=32%>Name</th>'+\ - '<th width=40%>Documentation</th>'+\ - '<th width=24%>Message</th>'+\ - '<th width=4%>Status</th><tr/>'+'\n') + sys.stdout.write('<table width=100% border=1><tr>'+'\n') + sys.stdout.write('<th width=32%>Name</th>'+'\n') + sys.stdout.write('<th width=40%>Documentation</th>'+'\n') + if "Perf" and "Long" in suite.longname: + sys.stdout.write('<th width=24%>Message</th>'+'\n') + sys.stdout.write('<th width=4%>Status</th><tr/>'+'\n') + sys.stdout.write('</tr>') 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 = '<h'+str(level)+'>' mark_r = '</h'+str(level)+'>' sys.stdout.write(mark_l+suite.name+mark_r+'\n') + sys.stdout.write('<p>'+re.sub(r"(\*)(.*?)(\*)", r"<b>\2</b>",\ + suite.doc, 0, flags=re.MULTILINE).replace(\ + '[', '<br>[')+'</p>\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('<tr>'+'\n') sys.stdout.write('<td>'+test.name+'</td>'+'\n') sys.stdout.write('<td>'+test.doc+'</td>'+'\n') - sys.stdout.write('<td>'+test.message+'</td>'+'\n') + if any("PERFTEST_LONG" in tag for tag in test.tags): + sys.stdout.write('<td>'+test.message+'</td>'+'\n') sys.stdout.write('<td>'+test.status+'</td>'+'\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 |