Showing results for 
Search instead for 
Did you mean: 

Groovy script to start REST mock

Occasional Visitor

Groovy script to start REST mock



I found the below script to start and stop SOAP mock service. My requirement is to count the no.of hits for the mock and stop it once the hits count reach 3. The below script works fine to SOAP mock. But for rest mock this script doesn't work. Any idea how to start and stop REST Mock services using groovy script? I am aware of starting and stopping via maven plugin but it doesn't fir my requirement as I need to get the mock running count in my test steps.


def runner = testRunner.testCase.testSuite.project.mockServices["PFLUploadWebServiceMockService"].start()
runner.clearResults() "mock service started"

def runner = testRunner.testCase.testSuite.project.mockServices["PFLUploadWebServiceMockService"].getMockRunner()
assert runner.isRunning() == true
int resultCount = 0;
resultCount = runner.getMockResultCount() "result count : " + resultCount
runner.stop() "mock service stopped"

New Here?
Join us and watch the welcome video:
Top Kudoed Authors