-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for subresults in junit report plugin flavor
Define an experimental junit flavor for subresults.
- Loading branch information
Showing
4 changed files
with
183 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
|
||
<!-- | ||
This schema extends the `default` flavor and adds support for tmt | ||
subresults. It allows multiple occurrences of testsuite elements inside a | ||
<testsuites>. | ||
The <testsuite> is mapped to `tmt.Result` and the <testcase> is mapped to | ||
`tmt.SubResult`. | ||
--> | ||
|
||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> | ||
|
||
<xs:element name="failure"> | ||
<xs:complexType mixed="true"> | ||
<xs:attribute name="type" type="xs:string" use="required"/> | ||
<xs:attribute name="message" type="xs:string" use="required"/> | ||
</xs:complexType> | ||
</xs:element> | ||
|
||
<xs:element name="error"> | ||
<xs:complexType mixed="true"> | ||
<xs:attribute name="type" type="xs:string" use="required"/> | ||
<xs:attribute name="message" type="xs:string" use="required"/> | ||
</xs:complexType> | ||
</xs:element> | ||
|
||
<xs:element name="skipped"> | ||
<xs:complexType mixed="true"> | ||
<xs:attribute name="type" type="xs:string" use="required"/> | ||
<xs:attribute name="message" type="xs:string" use="required"/> | ||
</xs:complexType> | ||
</xs:element> | ||
<xs:element name="system-err" type="xs:string"/> | ||
<xs:element name="system-out" type="xs:string"/> | ||
|
||
<xs:element name="testcase"> | ||
<xs:complexType> | ||
<xs:sequence> | ||
<xs:element ref="skipped" minOccurs="0" maxOccurs="1"/> | ||
<xs:element ref="error" minOccurs="0" maxOccurs="1"/> | ||
<xs:element ref="failure" minOccurs="0" maxOccurs="1"/> | ||
<xs:element ref="system-out" minOccurs="0" maxOccurs="1"/> | ||
<xs:element ref="system-err" minOccurs="0" maxOccurs="1"/> | ||
</xs:sequence> | ||
<xs:attribute name="name" type="xs:string" use="required"/> | ||
<xs:attribute name="time" type="xs:string" use="optional"/> | ||
</xs:complexType> | ||
</xs:element> | ||
|
||
<xs:element name="testsuite"> | ||
<xs:complexType> | ||
<xs:sequence> | ||
<xs:element ref="testcase" minOccurs="0" maxOccurs="unbounded"/> | ||
<xs:element ref="system-out" minOccurs="0" maxOccurs="1"/> | ||
<xs:element ref="system-err" minOccurs="0" maxOccurs="1"/> | ||
</xs:sequence> | ||
<xs:attribute name="name" type="xs:string" use="required"/> | ||
<xs:attribute name="tests" type="xs:string" use="required"/> | ||
<xs:attribute name="failures" type="xs:string" use="required"/> | ||
<xs:attribute name="errors" type="xs:string" use="required"/> | ||
<xs:attribute name="disabled" type="xs:string" use="required"/> | ||
<xs:attribute name="skipped" type="xs:string" use="required"/> | ||
<xs:attribute name="time" type="xs:string" use="required"/> | ||
<xs:attribute name="timestamp" type="xs:string" use="required"/> | ||
</xs:complexType> | ||
</xs:element> | ||
|
||
<xs:element name="testsuites"> | ||
<xs:complexType> | ||
<xs:sequence> | ||
<xs:element ref="testsuite" minOccurs="0" maxOccurs="unbounded"/> | ||
</xs:sequence> | ||
<xs:attribute name="time" type="xs:string" use="required"/> | ||
<xs:attribute name="tests" type="xs:string" use="required"/> | ||
<xs:attribute name="failures" type="xs:string" use="required"/> | ||
<xs:attribute name="disabled" type="xs:string" use="required"/> | ||
<xs:attribute name="errors" type="xs:string" use="required"/> | ||
</xs:complexType> | ||
</xs:element> | ||
</xs:schema> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
{% extends "_base.xml.j2" %} | ||
|
||
{# | ||
This flavor changes the level of `<testsuite>` and `<testcase>` tags. The | ||
`tmt.Result` becomes ``<testsuite>`` instead of ``testcase`` and | ||
``<testcase>`` tags become ``tmt.SubResult``. | ||
#} | ||
|
||
{% block content %} | ||
<testsuites disabled="0" errors="{{ RESULTS.errored | length }}" failures="{{ RESULTS.failed | length }}" tests="{{ RESULTS | length }}" time="{{ RESULTS.duration }}"> | ||
|
||
{% block testsuites %} | ||
{% for result in RESULTS %} | ||
{% set main_log = result.log | first | read_log %} | ||
{% set main_log_failures = main_log | failures | e %} | ||
{% set main_test_duration = result.duration | duration_to_seconds %} | ||
|
||
<testsuite name="{{ result.name | trim | e }}" disabled="0" errors="{{ result.subresult.errored | length }}" failures="{{ result.subresult.failed | length }}" skipped="{{ result.subresult.skipped | length }}" tests="{{ result.subresult | length }}" time="{{ main_test_duration }}" timestamp="{{ result.start_time }}"> | ||
|
||
{# | ||
TODO: | ||
The `error`, `failure` and `skipped` tags are probably not allowed within the testsuite | ||
{% if result.result.value == 'error' or result.result.value == 'warn' %} | ||
<error type="error" message="{{ result.result.value | e }}">{{ main_log_failures }}</error> | ||
{% elif result.result.value == 'fail' %} | ||
<failure type="failure" message="{{ result.result.value | e }}">{{ main_log_failures }}</failure> | ||
{% elif result.result.value == 'info' %} | ||
<skipped type="skipped" message="{{ result.result.value | e }}">{{ main_log_failures }}</skipped> | ||
{% endif %} | ||
#} | ||
|
||
{% if INCLUDE_OUTPUT_LOG and result_log %} | ||
<system-out>{{ main_log | e }}</system-out> | ||
{% endif %} | ||
|
||
{% for subresult in result.subresult %} | ||
{% set subresult_log = subresult.log | first | read_log %} | ||
{% set subresult_log_failures = main_log | failures | e %} | ||
{% set subresult_test_duration = subresult.duration | duration_to_seconds %} | ||
|
||
<testcase name="{{ subresult.name | e }}" {% if subresult_test_duration %}time="{{ subresult_test_duration }}"{% endif %}> | ||
{% if subresult.result.value == 'error' or subresult.result.value == 'warn' %} | ||
<error type="error" message="{{ subresult.result.value | e }}">{{ subresult_log_failures }}</error> | ||
{% elif subresult.result.value == 'fail' %} | ||
<failure type="failure" message="{{ subresult.result.value | e }}">{{ subresult_log_failures }}</failure> | ||
{% elif subresult.result.value == 'info' %} | ||
<skipped type="skipped" message="{{ subresult.result.value | e }}">{{ subresult_log_failures }}</skipped> | ||
{% endif %} | ||
|
||
{% if INCLUDE_OUTPUT_LOG and subresult_log %} | ||
<system-out>{{ subresult_log | e }}</system-out> | ||
{% endif %} | ||
</testcase> | ||
{% endfor %} | ||
|
||
{# | ||
TODO: | ||
Add properties from testcase into testsuite and test with Polarion? | ||
#} | ||
</testsuite> | ||
{% endfor %} | ||
{% endblock %} | ||
|
||
{# | ||
TODO: | ||
Add properties | ||
#} | ||
|
||
</testsuites> | ||
{% endblock %} |