SOAP Request not able create using Groovy
Hi All,
I am getting error while I am creating SOAP Request using below code. Could someone assist on this.
1. Create a Project->Test Suite->Test Case->Properties Files-> I am able to create till this level but I am getting error
when I create SOAP request.
import com.eviware.soapui.impl.wsdl.*
import com.eviware.soapui.impl.WsdlInterfaceFactory
import com.eviware.soapui.impl.wsdl.teststeps.registry.WsdlTestRequestStepFactory
import com.eviware.soapui.impl.wsdl.teststeps.registry.GroovyScriptStepFactory
import com.eviware.soapui.impl.wsdl.teststeps.registry.WsdlTestRequestStepFactory
import com.eviware.soapui.impl.wsdl.teststeps.registry.GroovyScriptStepFactory
import com.eviware.soapui.impl.wsdl.*
import com.eviware.soapui.impl.WsdlInterfaceFactory
String projectName = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
def workspace = testRunner.testCase.testSuite.project.workspace
def project = workspace.createProject('Project33333',new File("C:\\Temp\\" + projectName + ".xml"));
WsdlInterfaceFactory.importWsdl(project, 'http://www.webservicex.com/globalweather.asmx?WSDL', true)
def suite = project.addNewTestSuite("CustomerSuite")
tc = suite.addNewTestCase("CustomerTestCases")
ts = tc.addTestStep( 'properties', 'Excel-Values' )
ts.setPropertyValue( 'PropertyName', 'value' )
def operation = testRunner.testCase.testSuite.project.getInterfaceAt(0).getOperationList()[0]
def factory = new WsdlTestRequestStepFactory()
def arr = ["PEO","USC","USCS","ASC"]
for(def x : arr){
log.info "For each Loop" + operation;
config = factory.createConfig(operation,x)
//log.info "Config:::" + config;
testStep = ts.addTestStep(config)
testStep.properties['Request'].value = '<request>someData</request>'
}
context.testCase.testSuite.project.save()
You have defined a new project so operation would be
def operation = project.getInterfaceAt(0).getOperationList()[0]
Test step must be added to test case
testStep = tc.addTestStep(config)