Forum Discussion
OK, I opened up your attached project... and I'm not seeing anything actual code in the project that includes these two loops...
But, that said, in a Keyword Test, if you want to loop through two different files, you're doing a nested loop. It would look something like this.
Notice that the second loop is indented under the first. This will cause both loops to iterate, the internal one will iterate once for each loop instance of the second loop.
Now, if you want to loop through two different files simultaneously without nesting, I'm not sure you can do that in KeywordTests. You can do it in Script Code using the DDT objects. It would look something like this:
function doubleLoop(){ var loopData1 = DDT.CSVDriver(Project.Path + '\\KeywordTests\\test1.csv'); var loopData2 = DDT.CSVDriver(Project.Path + '\\KeywordTests\\test2.csv'); while (!loopData1.EOF() && !loopData2.EOF()){ Log.Message('File 1 column 1 ' + loopData1.Value('column1') + ' and File 2 column 1 ' + loopData2.Value('column3')) loopData1.Next(); loopData2.Next(); } DDT.CloseDriver(loopData1.Name); DDT.CloseDriver(loopData2.Name); }
Were you SCRIPT language were you using in your answer relating to having 2 variables iterate through their values in the same data loop (ie. no NESTING of data loops)?
- tristaanogre7 years agoEsteemed Contributor
JavaScript... although, the syntax will work for JScript as well.
- rpd7 years agoContributor
I mean What not Were you.
Related Content
- 3 years agoMarkSchofer
- 3 months agoasantev2
Recent Discussions
- 2 days agoMW_Didata