| || |
Current Row on LocalSheet is incrementing
Apologies if this is not the correct approach but I've been using QTP this way for ages!
My scripts consist of an a "Main Action" which then calls external re-useable actions and various functions. This also creates a DataTable called "Main Action".
If there are input variables within a script which are the same for every test iteration on the Global Sheet, but the testers who provide the input spreadsheets may which to change globally for different runs, I store these in the first row of the "Main Action" DataTable.
Within the script, when these variables are required to be passed to the actions or functions, I refer to them via dtLocalSheet or GetSheet("Main Action").
If you're still confused, here's a real life example;
A system performs conditional processing based on a formula using a person's height and weight. The person's sex is also input but is not used within the calculation component. Therefore height and weight are variables within the Global Sheet and Sex is entered in the first row only of the Main Action sheet.
This approach has worked for many many*months but in my latest script (which uses the same actions and functions), the CurrentRow for the "Main Action" on increments by 1 after the first iteration on the Global Sheet.
Even if I use SetCurrentRow to "1", after the next re-useable action is called, it is set back to "2".
The only way I've got around this is by using SetCurrentRow before every re-useable action.
What is going on? Why is it suddenly incrementing?
Re: Current Row on LocalSheet is incrementing
If the call to the reusable action is at the end of the main action then it will incremenet it automatically to next row. Try setting the test to run on one iteration only instead of all rows.