Forum Discussion
M_McDonald
17 years agoSuper Contributor
project.getMockServiceList() will list all the services. Then you could create a MockRunner list and loop through the services to start them.
See http://www.soapui.org/apidocs/com/eviware/soapui/model/project/Project.html for all the Project methods.
This might work (not tested!)
See http://www.soapui.org/apidocs/com/eviware/soapui/model/project/Project.html for all the Project methods.
This might work (not tested!)
import com.eviware.soapui.model.mock.MockService;
import com.eviware.soapui.model.mock.MockRunner;
log.info("Attempting to start services")
def mockServiceList = project.getMockServices()
def mockRunnerList = []
try {
for (ms in mockServiceList) {
MockRunner mr = ms.start()
mockRunnerList.add(mr)
}
// add to mockRunnerList to context for later access in tear down
context.put("runnerList", mockRunnerList)
log.info("Services started")
} catch (Exception e) {
for (mr in mockRunnerList) {
// cancel all started services
mr.cancel("Startup of some services failed.")
}
}