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 inserting this in my request ${#[Scripts#Random IBAN#Random IBAN]#result}. This will always return the same result(iban).
How can I make the script generate a new iban when called from other tests without inserting hundreds of "Run TestCase" steps before every request that uses an iban?
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.