Forum Discussion

Mladscha's avatar
Mladscha
Senior Member
7 years ago

How to reach a mock service from a script step?

Hello,

 

I can't find how to reach one of the mock services on the ServiceV tab from a Groovy test step in the SoapUI Pro.

In my project there are 3 different mock services derived from the WSDL. 

I'd like to have a possibility to start and stop a certain mock service during the test execution using script step in order to get asynchronous responses on the SOAP-requests  I send to the tested system (see the attachment).

I tried to implement it this way:

 

def mockService = testRunner.testCase.testSuite.project.getMockServiceByName( "My MockService" )

mockService.start()

 

but it didn't work as I expected. I couldn't track the transaction log and on the ServiceV tab I couldn't see if any mock service was running.

 

Could you please help me with this issue?

 

Best regards

Maria 

1 Reply

  • StevenColon's avatar
    StevenColon
    SmartBear Alumni (Retired)

    Thank you for posting to our Community Forum.

     

    Currently, there is no way to use groovy scripting to start/stop virts. First reason being that you cannot see any of the UI/ transaction log in ServiceV. I also saw during my investigation, even though there is start() that there is no stop() method implemented.

     

    The best way to do this is by using the VirtRunner test step to start and stop virts in automated testing.

     

    Here is our documentation on that test step: https://support.smartbear.com/readyapi/docs/soapui/steps/virt-runner.html

     

    Let me know if you have any questions/concerns.