<?xml version="1.0" ?>
{% block content %}
<testsuites disabled="0" errors="{{ RESULTS.errored | length }}" failures="{{ RESULTS.failed | length }}" tests="{{ RESULTS | length }}" time="{{ RESULTS.duration | float }}">
    {% block testsuites %}
    <testsuite name="{{ PLAN.name | trim | e }}" disabled="0" errors="{{ RESULTS.errored | length }}" failures="{{ RESULTS.failed | length }}" skipped="{{ RESULTS.skipped | length }}" tests="{{ RESULTS | length }}" time="{{ RESULTS.duration | float }}">
        {% block testcases %}
            {% for result in RESULTS %}
                {% set test_duration = result.duration | duration_to_seconds | float %}

                <testcase name="{{ result.name | e }}" {% if test_duration %}time="{{ test_duration }}"{% endif %}>
                    {% if result.result.value == 'error' or result.result.value == 'warn' %}
                        <error type="error" message="{{ result.result.value | e }}">{{ result.log | first | read_log | failures | e }}</error>
                    {% elif result.result.value == 'fail' %}
                        <failure type="failure" message="{{ result.result.value | e }}">{{ result.log | first | read_log | failures | e }}</failure>
                    {% elif result.result.value == 'info' %}
                        <skipped type="skipped" message="{{ result.result.value | e }}">{{ result.log | first | read_log | failures | e }}</skipped>
                    {% endif %}

                    {% if INCLUDE_OUTPUT_LOG and result.log %}
                        <system-out>{{ result.log | first | read_log | e }}</system-out>
                    {% endif %}

                    {# Optionally add the result properties #}
                    {% if result.properties is defined %}
                        {% with properties=result.properties %}
                            {% include "includes/_properties.xml.j2" %}
                        {% endwith %}
                    {% endif %}
                </testcase>
            {% endfor %}
        {% endblock %}
    </testsuite>
    {% endblock %}

    {# Optionally include the properties section in testsuites tag #}
    {% if RESULTS.properties is defined %}
        {% with properties=RESULTS.properties %}
            {% include "includes/_properties.xml.j2" %}
        {% endwith %}
    {% endif %}
</testsuites>
{% endblock %}
