Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate test report using pytest?

Tags:

python

pytest

How can I generate test report using pytest? I searched for it but whatever i got was about coverage report. I tried with this command:

py.test sanity_tests.py --cov=C:\Test\pytest --cov-report=xml 

But as parameters represents it generates coverage report not test report. Please help!!

like image 925
fhulprogrammer Avatar asked Mar 18 '15 13:03

fhulprogrammer


People also ask

Can pytest run unittest tests?

pytest supports running Python unittest -based tests out of the box. It's meant for leveraging existing unittest -based test suites to use pytest as a test runner and also allow to incrementally adapt the test suite to take full advantage of pytest's features.


1 Answers

Ripped from the comments: you can use the --junitxml argument.

$ py.test sample_tests.py --junitxml=C:\path\to\out_report.xml 
like image 52
Adam Smith Avatar answered Sep 29 '22 04:09

Adam Smith