Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed description bug #86

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
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
8 changes: 6 additions & 2 deletions HtmlTestRunner/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,12 @@ def callback():
self.callback = callback

def getDescription(self, test):
""" Return the test description if not have test name. """
return str(test)
""" Return the test description if it has one, otherwise return the test name. """
doc_first_line = test.shortDescription()
if self.descriptions and doc_first_line:
return doc_first_line
else:
return ''

def startTest(self, test):
""" Called before execute each method. """
Expand Down
8 changes: 4 additions & 4 deletions HtmlTestRunner/template/report_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ <h2 class="text-capitalize">{{ title }}</h2>
{%- for test_case in tests_results %}
{%- if not test_case.subtests is defined %}
<tr class='{{ status_tags[test_case.outcome] }}'>
<td class="col-xs-10">{{ test_case.test_id.split(".")[-1] }}</td>
<td class="col-xs-10">{{ test_case.test_description or test_case.test_id.split(".")[-1]}}</td>
<td class="col-xs-1">
<span class="label label-{{ status_tags[test_case.outcome] }}" style="display:block;width:40px;">
{%- if test_case.outcome == test_case.SUCCESS -%}
Expand Down Expand Up @@ -71,7 +71,7 @@ <h2 class="text-capitalize">{{ title }}</h2>
{%- endif %}
{%- else %}
<tr class='{{ status_tags[test_case.outcome] }}'>
<td class="col-xs-10">{{ test_case.test_id.split(".")[-1] }}</td>
<td class="col-xs-10">{{ test_case.test_description or test_case.test_id.split(".")[-1] }}</td>
<td class="col-xs-1">
<span class="label label-{{ status_tags[test_case.outcome] }}" style="display:block;width:40px;">
{%- if test_case.outcome == test_case.SUCCESS -%}
Expand All @@ -95,7 +95,7 @@ <h2 class="text-capitalize">{{ title }}</h2>
<tbody>
{%- for subtest in test_case.subtests %}
<tr class='{{ status_tags[subtest.outcome] }}'>
<td class="col-xs-10">{{ subtest.test_id.split(".")[-1] }}</td>
<td class="col-xs-10">{{ subtest.test_description or test_case.test_id.split(".")[-1] }}</td>
<td class="col-xs-1">
<span class="label label-{{ status_tags[subtest.outcome] }}" style="display:block;width:40px;">
{%- if subtest.outcome == subtest.SUCCESS -%}
Expand Down Expand Up @@ -159,4 +159,4 @@ <h2 class="text-capitalize">{{ title }}</h2>
});
</script>
</body>
</html
</html