Forum Discussion
I agree with tristaanogre that I don't think you need a data loop here at all. You would use that if you wanted to perform some tests over and over on one product, using a different line of data each time. What you have is a collection of data to be used in the same test on a different product each time.
Rather than having the values Prod1, Prod2 and so on in that first column, is there a product name or part of a name that you can read off the application that you could use in there instead? For instance, if you are logging into Prod1 you launch it and it is called MyProduct1 in the window somewhere, then I would change that first column to MyProduct1 in the Excel sheet. Then when you launch the application inside the test, the test can read the product name and use that string to look up the correct line in the Excel sheet.
This will let you run the test on each product but not have to stop and tell the test each time which product and Excel line to use. It will be smart enough to know on its own.
Does that make sense?
ETA: You may still need the loop there in order to allow searching for the correct product line, but at least you will not need to enter a product number every time.
Marsha,
Yes we have product names which are unique Ex: Auto, Homeowner..ctc.and Each product has unique set of data. I can read the product name only after initializing the application..
"For instance, if you are logging into Prod1 you launch it and it is called MyProduct1 in the window somewhere, then I would change that first column to MyProduct1 in the Excel sheet. Then when you launch the application inside the test, the test can read the product name and use that string to look up the correct line in the Excel sheet."
Can you guide with steps how to read and update excel. And also changes need to make in the test to read the product name and use that string to look up the correct line in the Excel sheet
In advance really appreciated your help
- Marsha_R9 years ago
Champion Level 3
I don't know javascript but I can give you a general idea
Create a project variable called ProductName and then do something like this
*whatever you do to start application*
Set variable ProductName = product name as read from window
DDT loop
while (not out of Excel lines) and (Excel.FirstColumn.Value not equal to Project.Variables.ProductName
next DDT /* stop when you find the right product or if it's not found at all*
If Excel.FirstColumn.Value = Project.Variables.ProductName then
use Excel values to log in
Else
product wasn't found in Excel, log error
*other test steps follow here*
If you need javascript syntax, someone else will have to jump in. :)