23

I am working on a web-project. I have created one Http Url Connection. But for that, I have to test the code for time-out InterruptedIOException, that will execute on time-out, but even after setting time-out time as 1msec, my case is executed successfully.

How can I make delay from SOAPUI, so that I can have time-out successfull?

pankaj_ar
  • 757
  • 2
  • 10
  • 33

4 Answers4

37

If you want to test how a client will react to a timeout, create a mockservice in SoapUI, and have it execute an OnRequest script prior to returning the (usually pre-determined) response. The script can be as simple as:

sleep(60000)

This would give you a 60-second delay before responding.

Chris Thornton
  • 15,620
  • 5
  • 37
  • 62
28

Select your response in the tree. Then at the bottom in "MockResponse Properties" look for: Look For this

Flexo
  • 87,323
  • 22
  • 191
  • 272
7

If you need to simulate a timeout thrown from an HTTP connectivity, then better use the script

mockRequest.getHttpResponse().sendError(408)

This will generate an html response as well. You may set any HTTP code status you desire. You may put it in "OnRequest Script", or in the "Script" of an existing Mock Response.

DayaMoon
  • 357
  • 2
  • 7
-1

Use HTTP STatus property of Response Message set the value to 408