Forum Discussion

smtripathi99's avatar
Occasional Contributor
6 years ago

Running a test case of different project in a same workspace using maven soapui plugin in java



I have a project A in which i am running a groovy to call a test case of another project B in same workspace. When I run it in SoapUI 5.3 UI it works OK but in java using maven soapui plugin it is not working.


Project A (PriceQuoteService-Tests-soapui-project)  test step:


import com.eviware.soapui.impl.wsdl.*
import com.eviware.soapui.impl.wsdl.testcase.*
import com.eviware.soapui.model.testsuite.*
import com.eviware.soapui.model.project.ProjectFactoryRegistry
import com.eviware.soapui.impl.wsdl.WsdlProjectFactory
import com.eviware.soapui.impl.WorkspaceImpl;

def session = testRunner.testCase.testSuite.getPropertyValue("Session") session

def filePath
def groovyUtils=new
def os = System.getProperty("").toLowerCase(); os
filePath = groovyUtils.projectPath + "\\" + "SharedTests-soapui-project.xml"
else if(os.indexOf("nix") >= 0 || os.indexOf("nux") >= 0 || os.indexOf("mac") >= 0){
filePath = groovyUtils.projectPath + "/" +"SharedTests-soapui-project.xml"
filePath = groovyUtils.projectPath + "/" +"SharedTests-soapui-project.xml"
// Printing the value of the variable filePath

def workspace = context.testCase.testSuite.project.workspace
def testProject = (workspace==null) ? ProjectFactoryRegistry.getProjectFactory(WsdlProjectFactory.WSDL_TYPE).createNew(filePath) : workspace.getProjectByName("SharedTests")
if(! && workspace!=null) workspace.openProject(testProject)
WsdlTestCase testCase = testProject.getTestSuiteByName("SharedTests").getTestCaseByName("SetUp_GDS")["Session"].value = session
TestRunner runner =, false)



Project B (SharedTests-soapui-project) test case



Java code to run project A:


WsdlProject project = new WsdlProject(project A xml path);

File projectfile = new File(projectxmlpath);
String parent = projectfile.getParent();
File ws = new File(parent + File.separator + "default-soapui-workspace.xml");
WorkspaceImpl wsimpl = new WorkspaceImpl(parent + File.separator + "default-soapui-workspace.xml", null);
WsdlTestCaseRunner wsRunner = project.getTestSuiteByName(testSuiteName).getTestCaseByName(testCaseName).run(new PropertiesMap(), false);


No RepliesBe the first to reply