Forum Discussion

Jon's avatar
Jon
Contributor
16 years ago

Another datasource Q

Probably a simple one... hopefully.

I now have a case where I have an inner and outer loop.  Trouble is, the inner loop not only  needs to read from a datasource, it also needs to modify the read value (an int) by multiplying it by the current loop iteration value. 

ie:

Read in value: 1000
Current OUTER loop iteration: first time through.
Value to be sent in webservice request: 1000 + (10 * 0)

Read in value: 1000
Current OUTER loop iteration: second time through.
Value to be sent in webservice request: 1000 + (10 * 1)

Read in value: 1000
Current OUTER loop iteration: third time through.
Value to be sent in webservice request: 1000 + (10 * 2)


Notice the increment (0, 1, 2, ...).

I guess I'd need to have a script take that read-in value, massage it appropriately and store it to a property, which I can then use in a later test step.  Just don't know how I'd write the script portion.

Note that at the end of each inner loop, the datasource will be reset and the read will begin again.  There are (for now, for simple testing) 10 values to be read in (1000-1009, hence the '10' in the calculation in the pseudo code block, above).  The outer loop is itself driven by another datasource, which is never reset.

2 Replies

  • omatzura's avatar
    omatzura
    Super Contributor
    Hi Jon,

    how are you keeping track of the outer loop iteration value? (so I can get the script right..)

    regards,

    /Ole
    eviware.com
  • Jon's avatar
    Jon
    Contributor
    Well, I'm totally open to suggestions for improvement, but at this time, I have a TestCase property that stores the value.