In a declarative Microsoft webtest, is there any way to break out of a 'For' loop?
I am using the For loop's PageCounter in my requests and am searching for something in each page response. When I find 'something', I would like to break out of the loop. I'm sure this can easily be done in code, but I would like to stick to just the declarative test script.
This is in reference to a declarative .webtest file in a Visual Studio "Web Performance and Load Test" project.
In a comment you describe the code to be:
Loop (Initialize to 1, Increment by 1, While {{Pagecounter}} < 21) If (The context parameter "SelectedItemBank" does not exist) {{AdminServer}}/item-banks/list.ssp
You might terminate the loop early by writing a suitable value to Pagecounter
. It is easy to write a plugin that would set the value based on some test. I am not aware of any built in facilities that will modify the control of the loop.
For one load test I wrote a few simple plugins to do simple arithmetic on context parameter values. These I used to manipulate values to control a loop. For another load test I wrote a web test loop based on a context parameter existence. A plugin set the context parameter when the loop should be terminated.