Reputation: 151
I have a bunch of SOAP request messages in XML format. Is there a way to import them to a SoapUI project?
I want to import them and add as "Test Request" Test Step to an existing Test Case.
Upvotes: 4
Views: 11571
Reputation: 18517
An easy and more automatic way to do so is using a groovy script to automatically create the testStep request from a directory where you have you xml request files:
Your SOAPUI before groovy code execution looks like:
And the necessary groovy code:
import com.eviware.soapui.impl.wsdl.teststeps.registry.WsdlTestRequestStepFactory
import groovy.io.FileType
// get the current testCase to add testSteps later
def tc = testRunner.testCase
// get the testStep as template to create the other requests
def tsTemplate = tc.getTestStepByName("TestRequest template")
// create the factory to create testSteps
def testStepFactory = new WsdlTestRequestStepFactory()
def requestDir = new File("/your_xml_request_directory/")
// for each xml file in the directory
requestDir.eachFileRecurse (FileType.FILES) { file ->
def newTestStepName = file.getName()
// create the config
def testStepConfig = testStepFactory.createConfig( tsTemplate.getOperation(), newTestStepName )
// add the new testStep to current testCase
def newTestStep = tc.insertTestStep( testStepConfig, -1 )
// set the request which just create with the file content
newTestStep.getTestRequest().setRequestContent(file.getText())
}
Hope this helps,
Upvotes: 4
Reputation: 11
Another option is:
Upvotes: 1
Reputation: 12906
Or select "Load from..." when opening the context menu in the request view.
Upvotes: 1
Reputation: 5855
Copy/paste each into a new request, then right click on each request and add them to your test case.
Upvotes: 1