Ask a Question

Can you change the data source used in a Data Driven Loop using a script?

SOLVED
DanH
Contributor

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.

2 REPLIES 2
tristaanogre
Esteemed Contributor

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.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

Great, thanks for the reply.  I'm in  and out of meetingts at the moment, but will have a play as soon as I can. 

 

The current tests are KeyWord tests, and I'll look into calling the tests from a loop in a scrippted test.... I'm also wondering whether it might be worth simply converting the Keyword tests to script:  which might make it easier to change other aspects of the tests using scripts.

cancel
Showing results for 
Search instead for 
Did you mean: