pytest-html icon indicating copy to clipboard operation
pytest-html copied to clipboard

Is there any way to generate one HTML report from two pytest runs ?

Open david-fliguer-ws opened this issue 5 years ago • 10 comments

Hi,

Is there any way that I can get in one HTML the results of two pytest runs ?

Something like

pytest -k something && pytest -k something_else --html=report.html

The reason that I need to do it is actually a workaround for another problem that I have (Not related to pytest-html, related to running in parallel with pytest-xdist instead) but it might help me to workaround this in some way

Thanks !!!

david-fliguer-ws avatar Nov 06 '18 11:11 david-fliguer-ws

This isn't currently possible, sorry. I'm not even sure how we'd implement this without having some intermediate format to store the results in. Feel free to edit this issue to be an request for an enhancement, and we can see if anyone has time to look into it.

davehunt avatar Nov 06 '18 13:11 davehunt

there is a plan to have a json-lines based format to write reports out to

RonnyPfannschmidt avatar Nov 06 '18 13:11 RonnyPfannschmidt

I see.

there is a plan to have a json-lines based format to write reports out to

Interesting, in that way I could just open the JSON and add the results of the second run ?

david-fliguer-ws avatar Nov 06 '18 16:11 david-fliguer-ws

I am wondering if you could not obtain the same feature by loading junit or subunit reports which are kinda standard way of saving (and combining) unit-test execution results. This would allow you to build reports created by tools other than pytest.

Extra bonus: avoiding to create a new intermediary file format.

ssbarnea avatar Jun 24 '19 11:06 ssbarnea

Hello @david-fliguer-ws ,

Had the same issue. here is what i did:

  1. I used pytest's junit feature to write junit/xunit/xunit2 reports.
  2. I combined the unit-reports with junitparser.
  3. And finally i generated HTML reports with junit2html.

In the end I did not use "pytest_html" at all for this. thats the same wthat https://github.com/pytest-dev/pytest-html/issues/183#issuecomment-504978193 suggests.

honestly, i did not like how the reports from junit2html looked. But i guess there are more tools out there, that generate pretty reports from junit/xunit/xunit2 files.

jkowalleck avatar Dec 03 '20 18:12 jkowalleck

there is a plan to have a json-lines based format to write reports out to

It's live: https://github.com/pytest-dev/pytest-reportlog

BeyondEvil avatar Dec 03 '20 18:12 BeyondEvil

Hi guys 👋

I have decided to develop a utility that is able to merge several pytest-html reports. Very useful to those running pytest suites in parallel and want to combine the reports later.

Check it out: https://github.com/akavbathen/pytest_html_merger

Please open an Issue or contribute directly by creating a PR

Enjoy!

akavbathen avatar Mar 20 '22 14:03 akavbathen

Hi guys 👋

I have decided to develop a utility that is able to merge several pytest-html reports. Very useful to those running pytest suites in parallel and want to combine the reports later.

Check it out: https://github.com/akavbathen/pytest_html_merger

Please open an Issue or contribute directly by creating a PR

Enjoy!

Hey!

That's awesome!

Just a heads-up: We're rebuilding pytest-html from the ground up. It's very behind schedule at the moment, but it is moving forward - albeit slowly.

BeyondEvil avatar Mar 20 '22 15:03 BeyondEvil

Hi guys wave

I have decided to develop a utility that is able to merge several pytest-html reports. Very useful to those running pytest suites in parallel and want to combine the reports later.

Check it out: https://github.com/akavbathen/pytest_html_merger

Please open an Issue or contribute directly by creating a PR

Enjoy!

This is awesome -- thank you for sharing!

Tbruno25 avatar Mar 28 '22 17:03 Tbruno25

Hi guys 👋

I have decided to develop a utility that is able to merge several pytest-html reports. Very useful to those running pytest suites in parallel and want to combine the reports later.

Check it out: https://github.com/akavbathen/pytest_html_merger

Please open an Issue or contribute directly by creating a PR

Enjoy!

Hey, any chance to make this work for pytest-html-reporter generated reports.?

gargsakshi02 avatar Mar 29 '22 15:03 gargsakshi02