Forum Discussion
I am able to create multiple request.
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("Customer1111")
def tc = suite.addNewTestCase("CustomerUpdate")
def operation = testRunner.testCase.testSuite.project.getInterfaceAt(0).getOperationList()[0]
def factory = new WsdlTestRequestStepFactory()
def arr = ["d","g","b","z"]
for(def x : arr)
{
log.info "For each Loop" + x.toString();
config = factory.createConfig(operation,x)
testStep = tc.addTestStep(config)
testStep.properties['Request'].value = '<request>someData</request>'
}
context.testCase.testSuite.project.save()
Thanks
The name of each request should be variable inside the loop and probably the request value as well.
for(int i=0;i<3;i++) { def config = factory.createConfig(operation,requests[i]) def testStep = tc.addTestStep(config) testStep.properties['Request'].value = '<request>someData</request>' }
- steveKubik8 years agoOccasional Contributor
Hi,
Thanks for your reply, but I am getting error in my code : Looks I am missing something in my code. Please help me on this. I am struggling lot 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.GroovyScriptStepFactoryimport com.eviware.soapui.impl.wsdl.*
import com.eviware.soapui.impl.WsdlInterfaceFactoryString 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()- sakthivel8 years agoContributor
Could someone assist on this.
Related Content
- 4 years ago
- 5 years ago
Recent Discussions
- 15 years ago