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.

What is data-driven testing?

What is data-driven testing?

In this section, we will learn about data-driven testing by parameterizing our test cases. Data-driven testing is used when we have a predefined set of input and output data that can be used on a test case. For example, let's say we are creating a test case for a cube function. Normally, we will assert the return value of the function for only one number. Instead, testing the function for multiple numbers will guarantee less bugs. We can create a set of data, one for the number and the other for its cube. The number is our input and its cube is our expected output. Now we feed this data to our test case and run the same for each pair of input and output data. When we feed predefined set of data like this to our test cases, it's called data-driven testing.

Contents