In the previous example, we supplied the test data in the test code. However, you will find situations where you already have test data defined in external sources such as text files, spreadsheets, or databases. It is also a good idea to separate the test data from the code and put it in an external source for easy maintenance and avoid changes to the test code each time you want to update the values.
Let's explore how we can read the test data from the Comma separated values (CSV) files or Excel spreadsheets and supply it to
We will use the previous test case and move the data that we supplied to the
@data decorator into a separate CSV file called
testdata.csv instead ...