Skip to content

Commit 7b98460

Browse files
committed
Provide hide tag funtionality
1 parent 74d2eb6 commit 7b98460

File tree

4 files changed

+21
-11
lines changed

4 files changed

+21
-11
lines changed

robotframework_metrics/robotmetrics.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def generate_report(opts):
173173
174174
.tablecard {
175175
background-color: white;
176-
font-size: 15px;
176+
font-size: 14px;
177177
}
178178
179179
tr {
@@ -605,18 +605,19 @@ def generate_report(opts):
605605
th.string = "Error Message"
606606
tr.insert(4, th)
607607

608-
th = soup.new_tag('th')
609-
th.string = "Tags"
610-
tr.insert(5, th)
608+
if opts.showtags == "True":
609+
th = soup.new_tag('th')
610+
th.string = "Tags"
611+
tr.insert(5, th)
611612

612613
test_tbody = soup.new_tag('tbody')
613614
table.insert(11, test_tbody)
614615

615616
# GET TEST METRICS
616617
if group:
617-
group.spawn(result.visit, TestResults(soup, test_tbody, log_name, opts.fullsuitename))
618+
group.spawn(result.visit, TestResults(soup, test_tbody, log_name, opts.fullsuitename, opts.showtags))
618619
else:
619-
result.visit(TestResults(soup, test_tbody, log_name, opts.fullsuitename))
620+
result.visit(TestResults(soup, test_tbody, log_name, opts.fullsuitename, opts.showtags))
620621

621622
test_icon_txt = """
622623
<div class="row">

robotframework_metrics/runner.py

+7
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,13 @@ def parse_options():
9494
help="Use full suite name in report"
9595
)
9696

97+
general.add_argument(
98+
'-t', '--showtags',
99+
dest='showtags',
100+
default="False",
101+
help="Display tag name is test metrics"
102+
)
103+
97104
args = parser.parse_args()
98105
return args
99106

robotframework_metrics/test_results.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33

44
class TestResults(ResultVisitor):
55

6-
def __init__(self, soup, tbody, logname, full_suite_name):
6+
def __init__(self, soup, tbody, logname, full_suite_name, showtags):
77
self.soup = soup
88
self.tbody = tbody
99
self.log_name = logname
1010
self.full_suite_name = full_suite_name
11+
self.showtags = showtags
1112

1213
def visit_test(self, test):
1314
table_tr = self.soup.new_tag('tr')
@@ -49,6 +50,7 @@ def visit_test(self, test):
4950
table_td.string = test.message
5051
table_tr.insert(4, table_td)
5152

52-
table_td = self.soup.new_tag('td', style="word-wrap: break-word;max-width:100px; white-space: normal;text-align:left")
53-
table_td.string = str(test.tags)
54-
table_tr.insert(5, table_td)
53+
if self.showtags == "True":
54+
table_td = self.soup.new_tag('td', style="word-wrap: break-word;max-width:100px; white-space: normal;text-align:left")
55+
table_td.string = str(test.tags)
56+
table_tr.insert(5, table_td)

robotframework_metrics/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "3.1.7"
1+
__version__ = "3.1.8"

0 commit comments

Comments
 (0)