This will capture stdout in junit but will not print it
py.test --verbose simpletest.py --junit-xml=test.xml
This will not capture stdout in junit and will print it
py.test --verbose --capture=no simpletest.py --junit-xml=test.xml
How do I allow pytest to print to stdout and print stdout to junit xml?
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 tests. --verbose
command line argument is just to ouput detailed test results on console.
I also tried to generate a similar xml file by invoking my test script from another python script
pytest.main(["--verbose","--junitxml=filepath\\file.xml","filepath\\file.py"])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With