Forum Discussion
SmartBear_Suppo
Alumni
16 years agoHello,
This happens if you run a TestCase (or TestSuite, etc ) while the Request window is open. The assertions will then run twice. Once for the TestCase runner and once to display the results in the open Request window. If this causes a problem for you, please run the TestCase (or Suite or Project) with the Desktop panel for the Request closed. If you need to ensure that an assertion is only run once per "run" you could add this groovy snippet to the beginning of the assertion (only works for Script Assertions):
The above snippet will cause the assertion to stop executing if it has already been executed once in the current context. Note that if the Request is executed more than once, the Assertion will still only be run once.
Regards,
Dain
eviware.com
This happens if you run a TestCase (or TestSuite, etc ) while the Request window is open. The assertions will then run twice. Once for the TestCase runner and once to display the results in the open Request window. If this causes a problem for you, please run the TestCase (or Suite or Project) with the Desktop panel for the Request closed. If you need to ensure that an assertion is only run once per "run" you could add this groovy snippet to the beginning of the assertion (only works for Script Assertions):
if(!context[this.toString()]) {
context[this.toString()] = true
return
}
The above snippet will cause the assertion to stop executing if it has already been executed once in the current context. Note that if the Request is executed more than once, the Assertion will still only be run once.
Regards,
Dain
eviware.com