XML Reports
To create result files which can be read by Jenkins or other
Continuous integration servers.
First create test file test_addition.py
import pytest
def test_add():
assert (10+5 ==15)
def test_add_even():
a, b = 17, 5
assert(a+b < 15)
def test_add_odd():
assert (5+9==14)
assert (5+9==14)
We will now execute the tests from test_addition.py and generate
the xml by running
pytest test_addition.py -v
--junitxml=”C:\Reports\report_test_addition.xml”
The report_test_addition.xml will record the test execution
result. Find a sample report_test_addition.xml below.
Comments
Post a Comment