Forum Discussion
M_McDonald
16 years agoSuper Contributor
In a TestCase Groovy script you can do this:
If you want to stop them in the same TestCase, you can do this:
import com.eviware.soapui.model.mock.MockService;
import com.eviware.soapui.model.mock.MockRunner;
def mockServices = testRunner.testCase.testSuite.project.getMockServiceList()
def runners = []
MockRunner runner
context.put("runners",runners) // put runners in context so that they can be stopped later
for (mock in mockServices) {
try {
log.info "Starting ${mock.name}"
runner = mock.start()
runners << runner
} catch (Exception e) {
runner.cancel( "Could not start mock service ${mock.name}" )
}
}
If you want to stop them in the same TestCase, you can do this:
import com.eviware.soapui.model.mock.MockRunner;
def runners = context.get("runners")
for (MockRunner runner in runners) {
if (runner != null && runner.isRunning()) {
runner.stop()
}
}