Every moment an automation engineer think to make the framework more flexible, using an external source file as test data is one step towards making your framework more flexible, so that you can change your test data any time without changing your script.
If you do not maintain an external source file for test data and hard code the values you use in your script, so when you want different set of data, then you need to change in each script file if you want to change the data before running.
If you have an external source file, then you can read the file, basically it’s a key value pair, just read the values by using respective key, so you need not to go each script file and change the hard coded data.
We have several ways to achieve this, we can use excel sheet, json file, a typescript file etc..
in this post, we will see how to use json and ts file as external test data source.
Watch details here –
Find the code sample on ProtractorPOM github
Pull the project to your local drive and open in VSCode to practice. (Read the readme file for the Protractor setup)