Forum Discussion

roamware's avatar
15 years ago

How to use API for advanced cases in JUnit?

Hi all,

Im trying to do the following in a JUnit test case - but struggling to use the undocumented SoapUI API.

Using the API, I am able to select and invoke a particular soap request. However, I am unable to load request parameters into the SoapUI SOAP message. I understand that the mechanism is to first add the properties to the "TestSuite" context, but with out doing some crude XML parsing on the WsdlTestRequest, I am at a loss at how to "inject" them.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" >
<soapenv:Header/>
<soapenv:Body>
<urn:isRecipientTransactionSupported>
<urn:in0>??</urn:in0>
</urn:isRecipientTransactionSupported>
</soapenv:Body>
</soapenv:Envelope>


Should become ... before its submitted...

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" >
<soapenv:Header/>
<soapenv:Body>
<urn:isRecipientTransactionSupported>
<urn:in0>xyz</urn:in0>
</urn:isRecipientTransactionSupported>
</soapenv:Body>
</soapenv:Envelope>


where xyz is a parameter that is "injected" programatically (via property transfer? or some means)

Some documentation on this kind of usuage would be much appreciated - surely others are using SOAP UI for this? Using the GUI is great, but limited for complex automation...

As a summary, my aim is ..

1. Load arbitary request parameters from a source outside SoapUI
2. Set up the nessesary API objects to Inject this data into a SOAP request as Soap paramteres. (i.e act like the GUI would)
3. Do all this from JUnit using pure Java - using the SOAP UI API and not via groovy scripts or other ways.
No RepliesBe the first to reply