From the course: Playwright Python and Pytest for Web Automation Testing: Master Modern Web Testing with Playwright and Pytest in Python

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Generate reports

Generate reports

In this one, we will learn how to generate HTML reports of our tests and do the same we'll use pytest HTML. Let's go ahead and first of all, install the same that is using pip install pytest HTML. And once that is installed, we can go ahead and use the same with the pytest command. That is when running our tests, let's run this one, I can use pytest command and tell it to run all the tests in the current directory like this, it goes ahead and does just that. And we get kind of a report in the log format like this. Now we want to generate a report instead and keep it for future purposes. To do that, we can use pytest HTML, which we just installed. So when we run our test using the pytest command, we can provide an additional option that will be hyphen hyphen HTML equals to the path of the report. That will be, let's say, report.html. We can store it in a directory as well. That would be, let's say, reports slash report.html. And if I go ahead and hit enter, it will go ahead and run the…

Contents