Forum Discussion
nmrao
12 years agoChampion Level 3
Hey,
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:
Request may look:
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
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
- mkhan0314868 years agoContributor
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)
- nmrao8 years agoChampion 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)
Related Content
- 10 months ago
- 6 years ago
- 2 years ago
- 9 years ago
Recent Discussions
- 2 days ago
- 2 days ago