Forum Discussion

SiKing's avatar
SiKing
Community Expert
14 years ago

testRunner.fail not working?

Hi all.

I am running SoapUI 3.5.1. Just stated Groovy scripting. How does testRunner.fail(message) work?
- I was under the impression, from the API docs and from Browsing other posts here, that the script and test would stop at this point. I have both "Fail on error" and "Fail TestCase if it has failed TestSteps" tuner on, but the script still continues. How do I get it to stop?
- In the GUI, I can see the message in the Log Output window. However, if I am running from the command line, where does the message go? I checked all three logs as well as the testcase.txt, and I do not see the message anywhere.

TIA for any valuable input.

5 Replies

  • Finan's avatar
    Finan
    Frequent Contributor
    Hi,

    In my case, I entered (in the testStep groovy Script) testRunner.fail("Isnotyourbusiness");
    It resulted in the log.output: "TestCase failed [Isnotyourbusiness], time taken = 22"

    And if I invoke it with the commandline runner, it is logged in the commandline interface, (and if specified, exported into my testCase report).

    See http://www.soapui.org/Test-Automation/f ... tests.html for more info on the commandline.

    (I tested it with the soapUI pro 4.0.0 and the soapUI pro 3.5.1)
  • SiKing's avatar
    SiKing
    Community Expert
    I still can't get it to work. I tried this:

    testRunner.fail("Isnotyourbusiness")
    log.info("Better not see this!")

    Expecting that I would not see the log.info, but I still see it. Further, when I run it from the command line launcher, I cannot find "Isnotyourbusiness" in any log anywhere.
  • SiKing's avatar
    SiKing
    Community Expert
    Thanx for the pointer.
    The only difference that I can see between testRunner.cancel() and testRunner.fail(), is that .fail will actually fail the test case and crash the testRunner (there is a Java stack trace). I'm kinda surprised that nobody is using this feature.