Skip to content

Commit

Permalink
Color the results of a testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
JokeWaumans committed Jan 10, 2024
1 parent 0516048 commit 7d0ca6e
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 2 deletions.
35 changes: 35 additions & 0 deletions doc/source/_static/xunit2rst.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
.xunit2rst-skip {
padding: 2px 5px;
font-size: 0.75em;
letter-spacing: 1px;
white-space: nowrap;
color: black;
background-color: #ddd;
border-radius: 3px;
background-color: #fed84f;
color: #000 !important;
}

.xunit2rst-pass {
padding: 2px 5px;
font-size: 0.75em;
letter-spacing: 1px;
white-space: nowrap;
color: black;
background-color: #ddd;
border-radius: 3px;
background-color: #97bd61;
color: #000 !important;
}

.xunit2rst-fail {
padding: 2px 5px;
font-size: 0.75em;
letter-spacing: 1px;
white-space: nowrap;
color: black;
background-color: #ddd;
border-radius: 3px;
background-color: #ce3e01;
color: #fff !important;
}
9 changes: 8 additions & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,14 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = [os.path.join(os.path.dirname(mlx.traceability.__file__), 'assets')]
html_static_path = [os.path.join(os.path.dirname(mlx.traceability.__file__), 'assets'),
'_static']

# These paths are either relative to html_static_path
# or fully qualified paths (eg. https://...)
html_css_files = [
'xunit2rst.css',
]

traceability_render_relationship_per_item = True

Expand Down
8 changes: 7 additions & 1 deletion mlx/xunit2rst.mako
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ def generate_body(input_string, indent, error_type=None):
wrapped = textwrap.fill(complete_string, width=(119 - len(indent)), break_on_hyphens=False, break_long_words=False)
return textwrap.indent(wrapped, indent)
%>\
.. role:: xunit2rst-Skip
.. role:: xunit2rst-Fail
.. role:: xunit2rst-Pass

.. ${info.header_prefix}${report_name}:

${"=" * len(title)}
Expand Down Expand Up @@ -135,7 +139,9 @@ else:
:ext_robotframeworklog: ${log_file}:${"s1-" if indexes[0] else ""}s${indexes[0] if indexes[0] else 1}-t${indexes[1]}
% endif
Test result: ${test_result}
<% role_name = "xunit2rst-" + test_result.lower() %>\
Test result: :${role_name}:`${test_result}`
<% prepend_literal_block = True %>
% if failure_msg and relationship != 'passes':
% for test in tests:
Expand Down

0 comments on commit 7d0ca6e

Please sign in to comment.