Forum Discussion

sakthivel's avatar
sakthivel
Contributor
7 years ago

Test Steps Creation in Eclipse and invoke SOAP UI

Hi ,

       I am new to Groovy and SOAP UI. I need to create Project->TestSuite->TestCases->Test Steps in Eclipse using Groovy and invoke from Eclipse to SOAP UI. Please let me know approach and  how to do this? Below is my running code in SOAP UI and I would like to run same in Eclipse. Would you please let know how to proceed?

 

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('jjjjjjjjjjjjjjjjjjjjjj',new File("C:\\Temp\\" + projectName + ".xml"));
WsdlInterfaceFactory.importWsdl(project, 'https://svn.apache.org/repos/asf/airavata/sandbox/xbaya-web/test/Calculator.wsdl', true)
def suite = project.addNewTestSuite("CustomerSuite")
tc = suite.addNewTestCase("CustomerTestCases")


testStep = tc.addTestStep( GroovyScriptStepFactory.GROOVY_TYPE, "getTestCasesToExecute" )
testStep.properties["script"].value = 'log.info "Sakthi"'


ts = tc.addTestStep( 'properties', 'Excel-Values' )
ts.setPropertyValue( 'PropertyName', 'value' )
def operation = project.getInterfaceAt(0).getOperationList()[0]
def factory = new WsdlTestRequestStepFactory()
def arr = ["PEO","USC"]
for(def x : arr){
log.info "For each Loop" + operation;
config = factory.createConfig(operation,x)
//log.info "Config:::" + config;
testStep = tc.addTestStep(config)
testStep.properties['Request'].value = '<request>someData</request>'
}

 

context.testCase.testSuite.project.save()

 

 

 

Thanks

Sakthi