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.

Running test

Running test

Now that we have parameterized our test case, we can go ahead and run the same using our pytest command. So let's use pytest, hit enter. You can see it goes ahead and collects six items and runs the same. That is our test root function given these six pair of input and output data. Now here we only see the dots and if we would like to see the input and the output data, we can go ahead and use pytest hyphen V flag. If I run the test now, you can see we get the name of the function that is test root and the data it received. That is 100, and 10, then 36, and 6, 25, 5, 16, 4, and so on. So if you want to know the data being passed to your test case, you can run your test with the hyphen V flag. So that's how you can use the parameterize function to pass a set of input and output data to any test case. Now it may look very useful but don't go using this for each and every test case. Sometimes it is just fine to test a function as it is like this. But sometimes we require parameterize like…

Contents