Posts

Retrieve Test Data from Json file in C# Selenium Framework

Image
  When we write an automation framework one of the many challenges is to use test data in our test scripts. One way is to hardcode the test data in our test scripts but this approach is not extensible, what if the test data change after some time? Then we have to change the hardcoded data in the test scripts themselves and if the same test data is used in various test scripts changing the hardcoded data from each test script will be time-consuming and will result in test script failure if some of the test data is not updated correctly. Another approach is to separate the test data from the test script and put the test data in an external file like Excel or JSON. In this blog, I will show you how we can retrieve the data from JSON files and use that data in our test script. I will be extending the  CalculatorFramework . Retrieve the Data from JSON files Create a new folder TestData and create a Data.json file Data.json { "Addition" : 16 , "Subtraction" : 2 , "Mu