Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions HtmlTestRunner/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ def __init__(self, stream, descriptions, verbosity):
self.callback = None
self.infoclass = _TestInfo
self.report_files = []
self.images = {}

def _prepare_callback(self, test_info, target_list, verbose_str,
short_str):
Expand Down Expand Up @@ -192,6 +193,9 @@ def stopTest(self, test):
if self.callback and callable(self.callback):
self.callback()
self.callback = None

if hasattr(test, 'screenshot'):
self.images[test._testMethodName] = test.screenshot

def addSuccess(self, test):
""" Called when a test executes successfully. """
Expand Down
2 changes: 2 additions & 0 deletions HtmlTestRunner/template/report_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ <h2 class="text-capitalize">{{ title }}</h2>
{%- if (test_case.stdout or test_case.err or test_case.err) and test_case.outcome != test_case.SKIP %}
<tr style="display:none;">
<td class="col-xs-9" colspan="3">
{%- set image_key = test_case.test_id.split(".")[-1] %}
{%- if test_case.stdout %}<p>{{ test_case.stdout }}</p>{% endif %}
{%- if test_case.err %}<p style="color:maroon;">{{ test_case.err[0].__name__ }}: {{ test_case.err[1] }}</p>{% endif %}
{%- if test_case.err %}<p style="color:maroon;">{{ test_case.test_exception_info }}</p>{% endif %}
{%- if test_case.err %}<p style="color:maroon;"><img src="data:image/jpeg;base64, {{ test_case.test_result.images[image_key] }}" alt="failure point" width="1000" height="600"></p>{% endif %}
</td>
</tr>
{%- endif %}
Expand Down