Forum Discussion

sakthivel's avatar
sakthivel
Contributor
7 years ago
Solved

Create SOAP UI Project using Groovy Script

Hi,
I need to create a project using Groovy Code in SOAP UI: Project->Test Suite->Test Cases with SOAP Requests. Here I would need to add Endpoint for this SOAP Request. I do have multiple SOAP request also Currently I am running this script with existing project.

 

below code is creating suite under existing project. I am not sure how to create Project using Groovy and adding SOAP Request with End point. Would you please give some piece of code or you may edit this code. Thanks in advance.



import com.eviware.soapui.impl.wsdl.teststeps.registry.WsdlTestRequestStepFactory
import com.eviware.soapui.impl.wsdl.teststeps.registry.GroovyScriptStepFactory
def suite = context.testCase.testSuite.project.addNewTestSuite("New Customer")
def tc = suite.addNewTestCase("CustomerUpdate")
def operation = testRunner.testCase.testSuite.project.getInterfaceAt(0).getOperationList()[0]
def factory = new WsdlTestRequestStepFactory()
def config = factory.createConfig(operation,'CustomerRequest')
def testStep = tc.addTestStep(config)
testStep.properties['Request'].value = '<request>someData</request>'
context.testCase.testSuite.project.save()

Thanks
Sakthi

  • PaulMS's avatar
    PaulMS
    7 years ago

    Do you have access to save the xml file in default directory C:\Program Files\SmartBear\SoapUI-5.3.0\bin?

     

    Or save in some other directory

    WsdlProject project = currentProject.getWorkspace().createProject(projectName, new File("C:\\Temp\\" + projectName + ".xml"));

6 Replies