Forum Discussion
dgiger
13 years agoNew Contributor
Hi,
I did manage to get it working with 2 groovy scripts and I would like to share it. Maybe someone find it useful or even has a better idea on how to make it working.
I needed 2 groovy scripts, as I wanted the MockService to start listening before the actual TestStep (the one that should NOT invoke a webservice call) is executing.
Start Groovy Script TestCase:
Stop Groovy Script TestCase:
Between the 2 Groovy Scripts the actual TestStep is executed.
Best Regards,
-dg-
I did manage to get it working with 2 groovy scripts and I would like to share it. Maybe someone find it useful or even has a better idea on how to make it working.
I needed 2 groovy scripts, as I wanted the MockService to start listening before the actual TestStep (the one that should NOT invoke a webservice call) is executing.
Start Groovy Script TestCase:
def runner = testRunner.testCase.testSuite.project.mockServices["TEST MockService"].start()
runner.clearResults()
log.info "mock service started"
Stop Groovy Script TestCase:
def runner = testRunner.testCase.testSuite.project.mockServices["TEST MockService"].getMockRunner()
assert runner.isRunning() == true
sleep(1000)
def resultCount = runner.getMockResultCount()
log.info "result count : " + resultCount
runner.stop()
log.info "mock service stopped"
assert resultCount == 0
Between the 2 Groovy Scripts the actual TestStep is executed.
Best Regards,
-dg-