I have create a test step in soapui. I need to set a long delay like 5 minutes for it. I mean that there is no delay between test steps, I have to wait a response only for one step. How can I do it?
Set the Socket Timeout to 300000 milliseconds. SoapUI Documentation
TestCase Options has a Socket timeout setting for that test. You cannot set this for only one step.
As other answers says it's not possible to set the socket timeout for a TestStep
, however you can do the trick with a TestStep
and groovy TestStep
. You can do it doing the follow steps:
TestStep
inside your TestCase
and disable it because you will run it from the groovy.Groovy testStep
which will change the global socket timeout before run the testStep
and setting again the default value after execution using com.eviware.soapui.SoapUI
class.The groovy
code you can use is showed below:
import com.eviware.soapui.SoapUI
import com.eviware.soapui.settings.HttpSettings
import com.eviware.soapui.model.testsuite.TestStepResult.TestStepStatus
// get the settings
def settings = SoapUI.getSettings();
// save the possible previous timeout
def bk_timeout = settings.getString(HttpSettings.SOCKET_TIMEOUT,"");
// set the new timeout... in your case 5 minutes in miliseconds
settings.setString(HttpSettings.SOCKET_TIMEOUT,"300000");
// save the new settings
SoapUI.saveSettings();
// get the testStep by name
def testStep = testRunner.testCase.getTestStepByName('Test Request')
// run it
def result = testStep.run( testRunner, context )
if( result.status == TestStepStatus.OK )
{
// ... if all ok
}
// when finish set the timeout to default value again
settings.setString(HttpSettings.SOCKET_TIMEOUT, bk_timeout)
SoapUI.saveSettings()
Your testCase will looks like:
Note that If you want to check if change settings through groovy
work as expected you can try modifying the properties and check if the preference SOAPUI
file in $USER_HOME\soapui-settings.xml
change (evidently to test it don't backup the original value again as in the sample :)
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With