Generating junitxml report with stdout missing
See original GitHub issueDescription
Pytest fails to generate junitxml report with captured stdout
after pytest 5.4.0.
pip list
Package Version
------------------ -------
apipkg 1.5
atomicwrites 1.3.0
attrs 19.3.0
execnet 1.7.1
filelock 3.0.12
importlib-metadata 1.5.0
more-itertools 8.2.0
packaging 20.3
pip 20.0.2
pluggy 0.13.1
py 1.8.1
pyparsing 2.4.6
pytest 5.4.1
pytest-forked 1.1.3
pytest-xdist 1.31.0
setuptools 46.0.0
six 1.14.0
wcwidth 0.1.8
zipp 3.1.0
pytest and operating system versions
pytest 5.4.1 Ubuntu 19.10
Example
Content of test_junit.py
:
def test_stdout():
print('Testing...')
Let’s run the test: pytest test_junit.py -v --junitxml result.xml
Content of result.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite errors="0" failures="0" hostname="likai-ubuntu" name="pytest" skipped="0" tests="1" time="0.010" timestamp="2020-03-20T19:11:11.630551">
<testcase classname="capture.test_junit" file="capture/test_junit.py" line="0" name="test_capture" time="0.000" />
</testsuite>
</testsuites>
If I run the same test with pytest 5.3.5, the result contains stdout:
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite errors="0" failures="0" hostname="likai-ubuntu" name="pytest" skipped="0" tests="1" time="0.011" timestamp="2020-03-20T19:17:00.902714">
<testcase classname="capture.test_junit" file="capture/test_junit.py" line="0" name="test_capture" time="0.000">
<system-out>Testing...</system-out>
</testcase>
</testsuite>
</testsuites>
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top Results From Across the Web
Pytest: Print to console and capture output in the junit report?
For pytest-2.3.5 we can generate a similar junit-xml output pytest --verbose --junitxml=filepath\\file.xml file.py. I tested this with file.py having pytest ...
Read more >_pytest.junitxml — pytest documentation
"""Report test results in JUnit-XML format, for use with Jenkins and build ... Note that the #xABs are *not* XML escapes - missing...
Read more >shoobx.junitxml - PyPI
A zope.testrunner output formatter & feature to output JUnit XML. ... Added missing stderr and stdout params to test_failure and test_error methods of ......
Read more >JUnit - Jenkins Plugins
The JUnit plugin provides a publisher that consumes XML test reports generated during the builds and provides some graphical visualization ...
Read more >Junit test report xml format - Carlino Edilizia
Publish Sep 15, 2015 · D-JUnit: This report generates XML files just like ... Publish Optional. test-report-junit-xml is a tool for producing JUnit...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
-o junit_logging=all
Well, here is the change: #6469 By default, no captured output is written. https://docs.pytest.org/en/latest/reference.html#confval-junit_logging