Forum Discussion
8 Replies
Sort By
- SmartBear_SuppoSmartBear Alumni (Retired)Hello,
from groovy test step:
def tsr = context.getProperty( "#TestSuiteRunner#" )
if( tsr != null ) tsr.cancel( "The assertion failed" )
but in script assertion try:
context.testRunner.cancel()
Let me know does this helps,
robert - cbyndrContributorThank you. This helps, but we're not quite there.
Adding this code to the groovy script step seems to stop the test suite, whether or not the assertion in the preceding test step fails.
How can I make the test suite stop if the assertion in the test step fails? Could I put the assertion in the script itself? By doing that I have only been able to stop the test case, not the test suite. - SmartBear_SuppoSmartBear Alumni (Retired)hi,
so here is my suggestion:
import com.eviware.soapui.model.testsuite.Assertable.AssertionStatus
def tsr = context.getProperty( "#TestSuiteRunner#" )
if( tsr != null ){
if( tsr.currentTestCase.getTestStepByName("My Request").assertionStatus==AssertionStatus.FAILED ){
tsr.cancel( "The assertion failed" )
}
}
also you need to uncheck 'Fail on error' option in Test Case options
Let us know if this helps
regards
nebojsa
eviware.com - cbyndrContributorthat will work i think, thank you!
- cbyndrContributorone more question, will this also work if running from the command line using testrunner?
- SmartBear_SuppoSmartBear Alumni (Retired)
- sapraoOccasional Contributor
Hi ,
I have same query , i have to stop the entire testsuite through groovy when soap response assertion is fail. I am able to stop the execution in test case level by using testrunner.cancel().
I have seen this blog in smart bear for this query
import com.eviware.soapui.model.testsuite.Assertable.AssertionStatus
def tsr = context.getProperty( "#TestSuiteRunner#" )
if( tsr != null ){
if( tsr.currentTestCase.getTestStepByName("My Request").assertionStatus==AssertionStatus.FAILED ){
tsr.cancel( "The assertion failed" )
}
}can i know that what value need to pass to "#TestSuiteRunner# property.. .
Thanks
- sapraoOccasional Contributor
Hi ,
Can anyone help me, how to stop the test suite execution through Groovy when any assertion is fail in run time.
I have seen above blog in the internet but it wouldn't worked out.
context.getProperty( "#TestSuiteRunner#" )
In above statement, what value i need to pass.
Thanks