summaryrefslogtreecommitdiffstats
path: root/src/testlib/qjunittestlogger_p.h
Commit message (Collapse)AuthorAgeFilesLines
* testlib: Replace custom QTestCoreList with std::vectorTor Arne Vestbø2021-09-101-1/+5
| | | | | | | | | | | | | | | | | The custom linked list implementation was implemented using recursion, and as a result didn't handle long lists of test cases, exhausting the stack on e.g. Windows where the default stack is only 1MB. This was the case with e.g. the tst_QChar test that produces 20K test cases. Replacing with a std::vector should do nicely for our use-case. No attempt has been made at further reducing the complexity of QTestElement/QTestCoreElement/QTestElementAttribute. Pick-to: 6.2 Change-Id: Ie295f7cf937ec6abdc4606b6120818551ad285c7 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* testlib: Produce <error> elements on fatal errors in JUnit reporterTor Arne Vestbø2021-08-101-0/+4
| | | | | | | | | Test errors represents unanticipated problems, e.g., an unhandled exception, or a problem with the implementation of the test. Pick-to: 6.2 Change-Id: I87219e7ffdea56862278f005de44526ad97545f0 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* testlib: Fix name of current test case element in JUnit reporterTor Arne Vestbø2021-08-061-1/+1
| | | | | | | Pick-to: 6.2 Change-Id: I0bd77e5f1d0540b87568a0c69a4b96442d4000eb Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* testlib: Improve JUnit XML conformanceTor Arne Vestbø2021-08-051-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The JUnit test framework did not initially have any XML reporting facilities built in. Instead, the XML report was generated by the Apache Ant JUnit task: https://github.com/apache/ant/search?q=filename%3AXMLJUnitResultFormatter.java Many users interacted with these reports via the Jenkins JUnit plugin, which provided graphical visualization of the test results: https://plugins.jenkins.io/junit/ Due to the lack of an official XML schema for the Apache Ant JUnit report there was some confusion about what the actual format was. People started documenting the de-facto format, both as produced by Ant, and as consumed by Jenkins: https://github.com/windyroad/JUnit-Schema/blob/master/JUnit.xsd https://github.com/junit-team/junit5/search?q=filename%3Ajenkins-junit.xsd The XML produced by the Qt Test JUnit reporter was far from these schemas, causing issues when importing results into tools such as Jenkins, Allure2, or Test Center. The following changes have been made to improve conformance: - The 'timestamp' attribute on <testsuite> is is now in ISO 8601 local time, without any time zone specified - The 'hostname' attribute on <testsuite> is now included - The 'classname' attribute on <testcase> is now included - The non-standard 'result' attribute on <testcase> has been removed - The non-standard 'result' attribute on <failure> has been renamed to 'type' - The <system-out> element on <testsuite> is always included, even when empty - The non-standard 'tag' attribute on <failure> has been removed. Data-driven tests are now represented as individual <testcase> elements, e.g.: <testcase name="someTest(someData X)" ...> <testcase name="someTest(someData Y)" ...> <testcase name="someTest(someData Z)" ...> The resulting XML validates against both the de-facto Apache Ant 'JUnit 4' schema and the Jenkins JUnit plugin schema. Task-number: QTBUG-95424 Change-Id: I6fc9abedbfb319f2545b99b37d059b18c16776ff Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* testlib: Simplify JUnit test loggerTor Arne Vestbø2021-08-051-1/+2
| | | | | | | | | | | | | - Use the right name for the attribute (AI_Message), rather than fixing it up in QTestJUnitStreamer. - Don't pretend that we're adding line and file information, only to discard it in QTestJUnitStreamer. - Don't pretend to add benchmark information, only to discard it in QTestJUnitStreamer. Pick-to: 6.2 Change-Id: Ib6eadc12300157216fe9c6e8bcfebd7eb8a3ea68 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QTestlib/JUnit XML: Log most messages to standard output instead of error outputFriedemann Kleint2021-01-151-1/+2
| | | | | | | | | | | | | | | Add an enumeration for system-out and alog element for it. Redirect the messages types that are not warnings/errors to this element. For compatibility, write it out only if it is not empty. Rename enumerations and members accordingly. [ChangeLog][QtTestLib] In JUnit XML, output that is not a warning/error is now logged under <system-out> instead of <system-err>. Fixes: QTBUG-86540 Change-Id: I55598eafa7dafa486ac5a8221029c332ff47413b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* testlib: Track current test suite in JUnit test loggerTor Arne Vestbø2020-07-221-0/+1
| | | | | | | | | Instead of deferring the creation of the test suite until logging stops, we create it up front, matching the logic of adding test elements on test function enter. Change-Id: I78b1ccdfde5493d78ef478d4b3c45d5a49358979 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* testlib: Clarify that our XUnit reporter is actually a JUnit reporterTor Arne Vestbø2020-02-031-0/+94
The reporter was probably named 'xunit' based on the historical use of xUnit to refer to testing frameworks derived from Smalltalk's SUnit. These frameworks typically added their own prefix, e.g. JUnit for Java, RUnit for R, etc. The most popular of these was the JUnit framework, and the corresponding XML output produced by the Ant built tool became somewhat of a de facto standard, which is probably why we chose to model our reporter after it. Nowadays however, naming it 'xunit' is problematic as there is actually a testing famework named xUnit.net, typically shortened to, you guessed it: xunit. Test report consumers will typically have a junit mode, and an xunit mode, and the latter could easily be mistaken for what testlib outputs, unless we clarify this. The clarification also allows us to safely extend our support for the JUnit XML format to incorporate some elements that are nowadays common, but where we are lagging behind the standard. [ChangeLog][QTestLib] The formerly named 'xunitxml' test reporter has been renamed to what it actually is: a JUnit test reporter, and is now triggered by passing -o junitxml to the test binary. Change-Id: Ieb20d3d2b5905c74e55b98174948cc70870c0ef9 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>