vendredi 26 mai 2017

Is there away to start/stop a mock service via groovy script as one of the groovy test steps?

I'd like to be able to start mock service in SOAPUI on test case setup script and close it through tear down script. I figured out how to start the service in setup script:

def project = null
def projectName = "myproject"
def workspace = testRunner.testCase.testSuite.project.getWorkspace();

//if running Soapui
if(workspace != null){
    project = workspace.getProjectByName(projectName)
}
else {
    log.error("Can't find workspace")
}
if (project != null) {
    log.info("Project " + projectName + " located!")    
    project.getMockServiceByName("myMockService").start(); 
     log.info("Project myMockService started!")
} else {
    log.error("Can't find " + projectName + " project, please start mock service manually") 
}

But having difficulties obtaining a reference to already running mock service in order to stop it. Any suggestion what should I script in tear down script to stop the service? enter image description here

Aucun commentaire:

Enregistrer un commentaire