Forum Discussion
SmartBear_Suppo
16 years agoSmartBear Alumni (Retired)
Hello!
This is due to the fact that there is no Workspace when running from command line, so you can't access other projects in this way. To be able to access another project, you need to manually load it. This can be done within the groovy script using the ProjectFactoryRegistry.
So, if you want your code to work both in regular soapUI and when run from the command line, you can write something like this:
Regards,
Dain
eviware.com
This is due to the fact that there is no Workspace when running from command line, so you can't access other projects in this way. To be able to access another project, you need to manually load it. This can be done within the groovy script using the ProjectFactoryRegistry.
So, if you want your code to work both in regular soapUI and when run from the command line, you can write something like this:
import com.eviware.soapui.model.project.ProjectFactoryRegistry
import com.eviware.soapui.impl.wsdl.WsdlProjectFactory
def workspace = testRunner.testCase.testSuite.project.workspace
def testProject = (workspace==null) ?
ProjectFactoryRegistry.getProjectFactory(WsdlProjectFactory.WSDL_TYPE).createNew("<path to your project>.xml") :
workspace.getProjectByName("ViewingCardManager_v15B4.0")
if(!testProject.open && workspace!=null) workspace.openProject(testProject)
testProject.properties["mqResponse"].value = "blahblah"
Regards,
Dain
eviware.com
Related Content
Recent Discussions
- 15 years ago