{% macro render_search_filter(report) %}
{% endmacro %} {% macro render_report_header(report) %}

{{ report.proj_name }}

Environment{{ report.env | upper }}
Base URL{{ report.base_url }}
Duration{{ report.duration }}
Start Time{{ report.start_time }}
End Time{{ report.end_time }}
{% endmacro %} {% macro render_summary(report) %} {% set passed = report.run_results.PASSED %} {% set failed = report.run_results.FAILED %} {% set broken = report.run_results.BROKEN %} {% set skipped = report.run_results.SKIPPED %} {% set total = passed + failed + broken + skipped %}

Test Results Summary

{{ total }}
Total
100%
{% for label, count, status in [('Passed', passed, 'passed'), ('Failed', failed, 'failed'), ('Broken', broken, 'broken'), ('Skipped', skipped, 'skipped')] %}
{{ count }}
{{ label }}
{{ (count / total * 100 if total > 0 else 0) | round(1) }}%
{% endfor %}
{% endmacro %} {% macro render_module(module_name, module_data, steps) %}

{{ module_name.split('\\')[-1] or module_name.split('/')[-1] or module_name }}

{% for status in ['PASSED', 'FAILED', 'BROKEN', 'SKIPPED'] %} {% if module_data.results[status] %} {{ module_data.results[status] }} {% endif %} {% endfor %}
{% for test_name, test_runs in module_data.tests.items() %} {{ render_test(test_name, test_runs, steps) }} {% endfor %}
{% endmacro %} {% macro render_status_summary(test_runs) %} {% set counter = {} %} {% for run in test_runs %} {% set count = counter.get(run.status, 0) + 1 %} {% set _ = counter.update({run.status: count}) %} {% endfor %} {% for status, count in counter.items() %} {{ count }} {{ status|lower }} {% endfor %} {% endmacro %} {% macro render_test(test_name, test_runs, steps) %} {% if test_runs|length == 1 %} {{ render_test_block(test_runs[0], steps) }} {% else %}
{{ test_name }} {{ render_status_summary(test_runs) }}
{% for run in test_runs %} {{ render_test_block(run, steps, is_sub=True) }} {% endfor %}
{% endif %} {% endmacro %} {% macro render_test_block(test_run, steps, is_sub=False, onclick="toggleTest(this)") %} {% set sub_class = "test-sub" if is_sub else "" %}
{{ render_test_header(test_run) }}
{{ render_test_tabs(test_run, steps) }}
{% endmacro %} {% macro render_test_header(test_run) %}
{{ test_run.name }} {{ test_run.status }} {{ test_run.duration or 0 }}s
{% endmacro %} {% macro render_test_tabs(test, steps) %}
{% set step_data = steps[test.steps] %} {% if step_data %} {% if step_data.get('setup') %}{% endif %} {% if step_data.get('call') %}{% endif %} {% if step_data.get('teardown') %}{% endif %} {% endif %} {% if test.attachments %}{% endif %} {% if test.error %}{% endif %}
{% if test.description %}{{ render_description(test.description) }}{% endif %} {% if test.info %}{{ render_info(test.info) }}{% endif %} {% if test.known_bugs %}{{ render_known_bugs(test.known_bugs) }}{% endif %}
{% if step_data %} {% for stage, steps in step_data.items() %}
{% for step in steps %} {{ render_step(step) }} {% endfor %}
{% endfor %} {% else %}
No step details available
{% endif %} {% if test.attachments %}
{{ render_attachments(test.attachments) }}
{% endif %} {% if test.error %}
{{ render_error(test.error, test.stacktrace) }}
{% endif %}
{% endmacro %} {% macro render_description(description) %}

Description

{{ description }}
{% endmacro %} {% macro render_info(info) %}

Information

{% for key, value in info.items() %}
{{ key }}
{{ render_info_value(value) }}
{% endfor %}
{% endmacro %} {% macro render_info_value(value) %} {% if value is mapping %} {% for sub_key, sub_value in value.items() %}
{{ sub_key }}: {{ render_info_value(sub_value) }}
{% endfor %} {% elif value is sequence and value is not string %} {% for sub_value in value %} {{ render_info_value(sub_value) }} {% endfor %} {% else %} {{ value }} {% endif %} {% endmacro %} {% macro render_known_bugs(known_bugs) %}

Known Bugs

{% for bug in known_bugs %}
{{ bug.description }}
{% if bug.url %} View Bug Report {% endif %}
{% endfor %}
{% endmacro %} {% macro render_step(step) %} {% set has_addons = step.expected or step.info or step.error or step.attachments or step.known_bugs %} {% if step.id.startswith('print_') %}
{{ step.title }}
{% else %}
{{ step.title }} {% if has_addons or step.steps %}
{% if step.error %}{% endif %} {% if step.attachments %}{% endif %} {% if step.info %}{% endif %} {% if step.known_bugs %}{% endif %} {% if step.expected %}{% endif %} {% if step.steps %} {% set count_steps = namespace(count=0) %} {% for s in step.steps %} {% if s.id.startswith('step_') %} {% set count_steps.count = count_steps.count + 1 %} {% endif %} {% endfor %} {{ count_steps.count }} sub step{{ 's' if count_steps.count > 1 else '' }} {% endif %}
{% endif %}
{% if has_addons %}
{% if step.expected %}

Expected

{{ step.expected }}
{% endif %} {% if step.info %} {{ render_info(step.info) }} {% endif %} {% if step.error %} {{ render_error(step.error.exc, step.error.tb) }} {% endif %} {% if step.attachments %} {{ render_attachments(step.attachments) }} {% endif %} {% if step.known_bugs %} {{ render_known_bugs(step.known_bugs) }} {% endif %}
{% endif %} {% if step.steps %}
{% for child_step in step.steps %} {{ render_step(child_step) }} {% endfor %}
{% endif %}
{% endif %} {% endmacro %} {% macro render_attachments(attachments) %}
{% for attachment in attachments %}
{% if attachment.type_.startswith('image/') %} {{ attachment.name }} {% else %} {% endif %} {{ attachment.name }}
{% endfor %}
{% endmacro %} {% macro render_error(exc, stacktrace) %}
{{ exc | escape }}
{% if stacktrace %}

Stacktrace:

{{ stacktrace | escape }}
{% endif %}
{% endmacro %}