DanH
6 years agoContributor
Can you change the data source used in a Data Driven Loop using a script?
I'm wanting to change the datasource (Excel spreadsheet) used in a Data-Driven loop. The scenario is, I have some tests which work fine, but I would like to feed different data into them from an Excel spreadsheet: The most straightforward way seems to be to create a number of different spreadsheets and use a script to decide which spreadsheet to use depending on trequirements.
Yes. Question, though, is whether or you're doing Keyword testing or Script testing. Script testing is easy... just make the excel file path in the ExcelDriver method a variable and change the variable assignment.
For Keyword testing, not quite so easy. What I would do is put the loop in script code and call the keyword test within the loop.