Tutorial 19 – Generate HTML report using Playwright Python
What you will Learn in this blog:
Install pytest html plugin
Generate html report
Generate report within a folder
Generate report with error logs
Install pytest html plugin
Let us first install pytest html plugin:
pip install pytest-html
Generate html report
Execute the command:
pytest -s -v --headed --html=pwreport1.html
The report gets generated
Open the report
Generate report within a folder
Let us introduce an error in script
Execute the command. This time the report will get generated inside the folder ‘Reports’
pytest -s -v --headed --html=Reports/pwreport2.html
Right now if you observe above, the report does not contain any error logs.
Generate report with error logs
Execute the command using --capture option
pytest -s -v --headed --html=pwreport3.html --capture=tee-sys
Open the report.
Notice this time that the error logs are visible
So this is how we can generate a simple html report.
Thank you for reading!