Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to produce HTML unit test output in Python?

I'm looking for any way to display the results of Python unit tests in an HTML summary. There are tools like this for Java and Ruby... haven't yet located any tools that seem to do this for Python. Are there any out there?

JUnit HTML output:

alt text
(source: ibm.com)

Ruby RSpec output:

alt text
(source: natontesting.com)

like image 927
Purrell Avatar asked Nov 18 '09 19:11

Purrell


People also ask

How do you create an HTML test report in Python?

To generate a HTML report for a Selenium test, we have to install a plugin with the command: pip install pytest-html. To generate the report, we have to move from the current directory to the directory of the Pytest file that we want to execute. Then run the command: pytest --html=report. html.


1 Answers

There are now ways to do it using Python. Using pytest, for example:

pip install pytest pytest-html

And then:

pytest --html=report.html --self-contained-html

Results in HTML of pytest

like image 193
vinzee Avatar answered Oct 18 '22 14:10

vinzee