1

Basically i have scenario where i need to run set of parallel pytests and another set of serial pytests separately. Each will generate separate pytest-html reports. But i am looking for solution to combine both the reports generated. Eg: py.test -n auto -m "not serial" --dist=loadfile --html=report1.html py.test -n auto -m "serial" --dist=loadfile --html=report2.html

Is there a way to combine report1.html and report2.html and generate single html report ?

  • 2
    No, there is no combining of HTML reports. You have to implement that yourself. – hoefling Nov 26 '21 at 12:29
  • As @hoefling said, it's not possible and there's a bug report on GitHub tracking it. https://github.com/pytest-dev/pytest-html/issues/183 Though people have use a workaround: * Use pytest's junit feature to write junit/xunit/xunit2 reports. * Combin the unit-reports with junitparser. * Generate HTML reports with junit2html. – oittaa Nov 26 '21 at 12:47
  • There is a new utility that does just that. I used it and it worked well for me. https://github.com/akavbathen/pytest_html_merger – Pavel Rogovoy Mar 20 '22 at 14:18

1 Answers1

1

Pytest HTML Merger

There is a new utility that is able to merge multiple pytest-html reports.

I have used it in my workplace and it worked great for us.

Assume you have multiple html reports under current directory ./.

Installation

pip install pytest-html-merger

Usage

pytest_html_merger -i ./ -o ./merged.html

Will generate a unified pytest-html report.

Tested on Linux but should work on Windows as well.

Link to github page

https://github.com/akavbathen/pytest_html_merger

Enjoy!

Pavel Rogovoy
  • 528
  • 4
  • 6