Forum Discussion

Sachin_Sawe's avatar
Sachin_Sawe
Contributor
16 years ago

How to abort a test case?

Ole,

Say you have a TestCase running with multiple test steps. In first test step you executed something and technically that step has not failed, however due to some reason you want to abort the test case at that time or may be after execution of currently executing test step.

How do you do that?

-Sachin

5 Replies

  • Ole,

    I figured out how I can abort the test step as I am able to do that by throwing an exception alone. But instead of throwing an exception I would like to show a display message, basically an alert box to tell user that "Something needs to be set first in order to execute this test case". How do I do that? ( just like how we show alert messages to the user in browser using javascript, got it? )
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi!

    you can abort the testCase run either by throwing an exception or by using one of the testRunner.cancel( "reason" ) or testRunner.fail( "reason" ) methods.

    Regarding the display of a popup, try using

    com.eviware.soapui.support.UISupport.showInfoMessage( "..." )

    regards!

    /Ole
    eviware.com
  • yes, Ole. that is exactly what I was looking for. I sort of remembered that there is way to flash a UI message but this time could not find the example any place. Thanks a lot.

    btw, I have written a new post on finding if a date time is in a given time slot in groovy. though this post is groovy related, the logic did help me in my soapUI testing various times. here it is

    http://onebyteatatime.wordpress.com/200 ... in-groovy/

    regards,
    Sachin
  • Ole,

    Hope you read my last post on this thread. I have added a link to my newer post on on datetime arithmatic in groovy.

    Btw, I tried the gui message flashing in soapUI. It works fine. However, the testRunner.cancel and testRunner.fail does not work. May be because I am trying to execute this in setupScript. Basically in my setup script I do some validations and if certain information is not present I don't want to proceed ahead executing that test case. For this type of scenario what method can I call on test case or any other object in order to not proceed with the test case?

    Thanks,
    -Sachin
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi Sachin,

    you're right, these calls only work from groovy script steps inside the testCase, I'll have a look at this.

    Nice post btw :-)

    regards!

    /Ole
    eviware.com