jdbc:oracle:thin:{schema name}/{password}@{hostname}:1521:{instance name}
Tag: SOAPUI
Need a UUID for use in SOAPUI?
Create a property using a Groovy Script test step with the following line :
def property = java.util.UUID.randomUUID()
or let SOAPUI parse it in-line :
${=java.util.UUID.randomUUID()}
Property Expansion in SOAPUI
From groovyinsoapui.wordpress.com :
Accessing variable values on the go while sending SOAP request to some service, might solve many problems at times. In SOAP UI, there are two ways to accomplish this
i) Using ‘Property Transfer’ step
ii) Using ‘Property Expansion’ accordingly wherever required. Here I am explaining this procedure fo accesing properties.
${#Scope#Property-name[#xpath-expression]}
${Property-name} refers to a Global Property
(example: ${UserName} to a global Property named “UserName”)
${#Project#Property-name}refers to a Project Property
(example: ${#Project#UserName} to a Property on Project level named “UserName”)
${#TestSuite#Property-name} refers to a TestSuite Property
(example: ${#TestSuite#UserName} to a Prop on TestSuite level named “UserName”)
${#TestCase#Property-name} refers to a TestCase Property
(example: ${#TestCase#UserName} to a Prop on TestCase level named “UserName”)
${TestStep-name#Property-name} refers to a property in a named TestStep.
SOAPUI – Catching Test Case Completion Time
To capture how long it took a particular test case to complete, use the following property expansion in your DataSink.
${=testRunner.TimeTaken}
The result is in milliseconds. It is the sum of the time taken by all test steps during the execution of your test case.
SOAPUI – Generating a Random Value
By placing the following property expansion in your SOAP request in SOAPUI, a random number between 0 and 50,000 will be inserted in it’s place.
${=(int)(Math.random()*50000)}
Use Epoch Time in SOAPUI as a unique value
Want SOAPUI to insert epoch time into your request to be used as a unique value when the request is submitted? Use the following string in your SOAP request and epoch time will be inserted in its place!
${= System.currentTimeMillis() }
Getting SOAPUI to Pass Back a Value froma Request Using a Mock Service
If need a Mock Service to reply to a SOAP request with a value from that request, here’s the Groovy script to do it. (Groovy is a scripting language that can be run in the Java JVM. SOAPUI has it built in.)
1) Select your Mock Service in SOAPUI
2) Select the Mock Service operation
3) Select the appropriate Mock Service response
4) Click the “Script” tab at the bottom of the response editor window
5) Paste the following code into the script editing pane, substituting your values
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context)
def holder = groovyUtils.getXmlHolder(mockRequest.requestContent)
def id = String.valueOf(holder.getNodeValue("THE NODE CONTAINING THE VALUE YOU WANT TO REPLY WITH HERE")
Context.setProperty("PARAMETER NAME HERE", id)
So basically you’re pulling the value from the node you define in line 3, into the variable called “id”. You’re then assigning the value of “id” to the parameter you define in line 4. You then insert the parameter into your response message and viola!
For example if the node you wanted to pull the value from was a node called “Name”, and the parameter you wanted to use was “nameid” then your code would look like this :
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context)
def holder = groovyUtils.getXmlHolder(mockRequest.requestContent)
def id = String.valueOf(holder.getNodeValue(“Name”))
context.setProperty(“nameid”, id)
You’d then put ${nameid} into your MockService response.