Let's use the following code (conftest.py) :
import random
def test_val():
value = random.random()
assert value < 0.5
Running py.test --junitxml=result.xml conftest.py
generates result.xml
(when the test passes):
<?xml version="1.0" encoding="utf-8"?>
<testsuite errors="0" failures="0" name="" skips="0" tests="1" time="0.047">
<testcase classname="conftest" name="test_val" time="0.0"/>
</testsuite>
Now. What I'd like to be able to do is to store the value generated by test_val()
in results.xml
. Is there a way to do it ? I can't seem to find anything related in pytest doc.
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