Forum Discussion

edweerdt's avatar
edweerdt
Contributor
5 years ago
Solved

New script result when called

I have a groovy script that generates a random iban. I want to be able to get the result from this script in a lot of teststeps.   I now have this script in a Scripts suite and use it by insertin...
  • Radford's avatar
    5 years ago

    The script generates the result when the step executes so the result is always the same when you reference this.

     

    Personally, I use the DataGen test step (instead of your Groovy Test Step), with a script property, if you set the mode to "READ" the property is recreated each time it is read.

     

    Important Caveat: The DataGen test step script property has been deprecated in favour of the Groovy Data Source data source of the DataSource test step. But I just like the sheer simplicity of the DataGen test step (and its what I've always used).

     

    For completeness, If your Groovy test step is a standalone function you could also move your Groovy code to an external Script Library.