I have read many posts which tells about how to use datatables and user defined internal environment variables. What I would like to know is the cons of each of them with respect to memory/time/performance. Which one is better to use and in what situation? Also, is there a way I can destroy user defined internal environment variables while the test is running?
Your responses will be highly appreciated.
Depends on the amount and nature of input data that you are using in your AUT. If data is not modified that often then you can go for Environment variables if not use Datatables. Best practice is to use data tables as they can be opened in excel. Environment variables values can be cleared while the test is running.
Thanks for your reply. I am aware of how to reset an environment variable during run time. What I want to know is the resource comparison.
If I'm running fifty test cases together using a driver script and only test case #1 uses environment variable then those environment variables will remain active for all the fifty test cases. Is there a way I can delete them in between? Or in such cases, datatable is the only good option?
Based on typical scenarios you can choose the right way in this order.
1. Use Datatables and spreadsheets if you want ease-of-use for end user/developer/tester for making changes into testdata.
2. If efficiency/speed is needed then create data dictionary from spreadsheets using above link.[Anshoo Arora - http://relevantcodes.com/qtp-creatin...ta-dictionary/ ]
3. Use environment variable for specific & limited situations demanding reusable persistant/static/global variables across tests/actions/projects. [Can use external XML files to load such environment variables] Typically if there is a driver variable based on which you want to select datasheets path & execute tests in Multiple Browsers OR multiple languages. Environment variable is your choice.