I used to have two projects that would run within a single execution in Jenkins. Both projects would share an excel spreadsheet. When the first project would run it would log information into the spreadsheet that would then be used by the second project. In order to run them both from a single Jenkins job I added this code as the teardown script at the Suite Level of the first project. And what it does is run the second project within the same workspace. It's not the easiest solution but it did work.
import com.eviware.soapui.impl.wsdl.WsdlProject
def project = null
projectPath=context.expand('${projectDir}')
def workspace = testSuite.project.getWorkspace();
try{
if(workspace != null){
project = workspace.getProjectByName("Project2")
project = new WsdlProject(projectPath+"/Project2-soapui-project.xml");
}
//if running in Jenkins/Hudson
else{
project = new WsdlProject(projectPath+"/Project2-soapui-project.xml");
}
}
catch(Exception e)
{
log.error("Service Exception desc : " + e.getMessage());
}
try{
if(project.open && project.name == "Project2" ) {
def properties = new com.eviware.soapui.support.types.StringToObjectMap ()
def testCase = project.getTestSuiteByName("Project2_TestSuite").getTestCaseByName("Project2Case");
if(testCase == null)
{
throw new RuntimeException("Could not locate testcase 'Project2Case'! ");
}
else{
testCase.setPropertyValue("projectPath_1", projectPath )
def runner = testCase.run(properties, false);
}
}
else{
throw new RuntimeException("Could not find project 'Project2' !")
}
}
catch(Exception e)
{
log.error("Service Exception desc : " + e.getMessage());
}
project = null