Forum Discussion
- nmraoChampion Level 3Please see if the below link helps
http://www.soapui.org/Scripting-Propert ... properties - Jack21ZOccasional ContributorHi,
Uhm, my test steps are the following:
GroovyScript --> script to generate data
PropertyTransfer --> Source: Groovy Script Target: SOAP Request
SOAP Request
My goal here is i'm not using any Test Properties of use case, test suite and others as possible
Regards,
Jack - nmraoChampion Level 3Sorry, please see this
http://www.soapui.org/Functional-Testin ... alues.html - Jack21ZOccasional Contributor
nmrao wrote: Sorry, please see this
http://www.soapui.org/Functional-Testin ... alues.html
Hi Rao,
You know any samples that the TransferProperty Source: Groovy Script?
Regards,
Jayson - nmraoChampion Level 3Hey,
In the first link provided has the sample how to set a value to a property and how to get the same. In this case, you would not require transfer property step at all. When property is used in the request, the value is automatically replaced when the request is sent.
For eg
There are two steps in a test case
Groovy
Test Step for soap request.
Groovy:
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
def timed = System.currentTimeMillis()
def myGeneratedValue = 'test_'+timed
testRunner.testCase.setPropertyValue("GENERATED_VALUE",myGeneratedValue)
Request may look:
<?xml version="1.0"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" >
<soapenv:Header/>
<soapenv:Body>
<Reference>${#TestCase#GENERATED_VALUE}</Reference>
</soapenv:Body>
</soapenv:Envelope>
Note that you do not need to set any property value manually. At run time ${#TestCase#GENERATED_VALUE} will replaced with generated value run time automatically if test case is run or run groovy step first and then request step.
And smilarly you use properties at TestSuite, Project level as well. Hope this helps- mkhan031486Contributor
Hi Rao,
I was actually stuck on the same issue as well, and you explained it beautifully. I have a question though...
What if I want to create the property in a test suite or at a project level.. what changes to I need to make to the below script???
testRunner.testCase.setPropertyValue("GENERATED_VALUE",myGeneratedValue)
- nmraoChampion Level 3
Set property / its value at suite level
context.testCase.testSuite.setPropertyValue("GENERATED_VALUE",myGeneratedValue)
project level:
context.testCase.testSuite.project.setPropertyValue("GENERATED_VALUE",myGeneratedValue)
- Jack21ZOccasional ContributorThanks Rao,
I figured it out!!!
groovy Scipt:
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
def timed = System.currentTimeMillis()
def myGeneratedValue = 'test_'+timed
return myGeneratedValue
PropertyTransfer Test Step:
Source: Groovy Script Property: result
Target: SOAP request Property: Request
Transfer the value from groovy -> soap request
SOAP request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" >
<soapenv:Header/>
<soapenv:Body>
<Reference>"value from groovy script"</Reference>
</soapenv:Body>
</soapenv:Envelope>
Regards,
Jack - nmraoChampion Level 3If i were you, do not use additional step - Property transfer which could be done groovy itself.
Related Content
- 5 years ago
- 2 years ago
- 9 years ago
Recent Discussions
- 2 days ago
- 2 days ago