Property Transfer Between Test Cases
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2011
04:45 AM
10-18-2011
04:45 AM
Property Transfer Between Test Cases
Hi,
Can someone let me know how can we transfer properties between Test Cases in soapUI?
soapUI.org more teaches about PT b/w test steps
Thanks -
soapUI Candidate
Can someone let me know how can we transfer properties between Test Cases in soapUI?
soapUI.org more teaches about PT b/w test steps
Thanks -
soapUI Candidate
9 REPLIES 9
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2011
12:51 AM
11-03-2011
12:51 AM
Hi,
Add a property to test suite. This property can be shared b/w all the test cases of that test suite.
The property value can be read/write from any test case of that suite.
Regards,
AnkitaT
Add a property to test suite. This property can be shared b/w all the test cases of that test suite.
The property value can be read/write from any test case of that suite.
Regards,
AnkitaT
Ankita
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2011
05:15 AM
11-03-2011
05:15 AM
Thank you Ankita T.
It worked well. Appreciating your help.
I would like to give your some star ratings, though I am new to this forum and i don't know how to do it.
^Regards
It worked well. Appreciating your help.
I would like to give your some star ratings, though I am new to this forum and i don't know how to do it.
^Regards
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2013
11:10 PM
01-07-2013
11:10 PM
Hi all..
I use JSON format for the request and response for a Web Test case. So how would u use XPATH in this? Does XPATH work for JSON? I m a Novice, excuse if this is silly.
Now..
I wanna append the values returned from a response of a HTTP Request test step, to be a part of an endpoint of another HTTP Request test step. I tried by selecting "Endpoint" as my target but its replacing the complete end point. I need to append only the value. Help me out or list the steps to do this..
I tried, to select a HTTP Test step as a source and select the property as the value from Response, then set another HTTP Test step as the target with its endpoint as the target property.
What i need is, juz append the value from the source as a part of the endpoint, say www.google.com/{the property}
How to do this? Is it possible in soapUI? If so, pls let me know the steps!
I use JSON format for the request and response for a Web Test case. So how would u use XPATH in this? Does XPATH work for JSON? I m a Novice, excuse if this is silly.
Now..
I wanna append the values returned from a response of a HTTP Request test step, to be a part of an endpoint of another HTTP Request test step. I tried by selecting "Endpoint" as my target but its replacing the complete end point. I need to append only the value. Help me out or list the steps to do this..
I tried, to select a HTTP Test step as a source and select the property as the value from Response, then set another HTTP Test step as the target with its endpoint as the target property.
What i need is, juz append the value from the source as a part of the endpoint, say www.google.com/{the property}
How to do this? Is it possible in soapUI? If so, pls let me know the steps!
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2013
02:47 AM
01-09-2013
02:47 AM
For JSON format, instead of XPath, usage of jsonslurper is recommended.
An example to achieve this is as:
import groovy.json.JsonSlurper
def response = messageExchange.response.responseContent
def slurper = new JsonSlurper()
def json = slurper.parseText response
def ExpectedResultMessage = context.expand( '${#TestCase#ResultMessage}' ).toString()
log.info 'ExpectedResultMessage ' + ExpectedResultMessage
log.info 'json response ' + json."nsms.Response"."nsms.msg"
assert json."nsms.Response"."nsms.msg" == ExpectedResultMessage
Hope it helps.
Regards,
Ankita
An example to achieve this is as:
import groovy.json.JsonSlurper
def response = messageExchange.response.responseContent
def slurper = new JsonSlurper()
def json = slurper.parseText response
def ExpectedResultMessage = context.expand( '${#TestCase#ResultMessage}' ).toString()
log.info 'ExpectedResultMessage ' + ExpectedResultMessage
log.info 'json response ' + json."nsms.Response"."nsms.msg"
assert json."nsms.Response"."nsms.msg" == ExpectedResultMessage
Hope it helps.
Regards,
Ankita
Ankita
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2013
03:36 AM
01-09-2013
03:36 AM
ankitaT wrote: For JSON format, instead of XPath, usage of jsonslurper is recommended.
An example to achieve this is as:
import groovy.json.JsonSlurper
def response = messageExchange.response.responseContent
def slurper = new JsonSlurper()
def json = slurper.parseText response
def ExpectedResultMessage = context.expand( '${#TestCase#ResultMessage}' ).toString()
log.info 'ExpectedResultMessage ' + ExpectedResultMessage
log.info 'json response ' + json."nsms.Response"."nsms.msg"
assert json."nsms.Response"."nsms.msg" == ExpectedResultMessage
Hope it helps.
Regards,
Ankita
Hi Ankita.. Let me give you the scenario and the steps I've tried to make things work.
Scenario: I should maintain a id throughout the test suite which contains 10 or more Test cases. The ID which I get on executing the first Test case, should be passed as a part of the endpoint for the next coming test cases, say wwww.google.com/{id}
I tried: Creating the test suite and test cases, then adding HTTP Test request test step for each test cases. And then, after the test case has finished executing, the response is written to a xml file by using a Groovy script as a test step. BTW both the request and response are in JSON format not in XML. After writing the response to a file, I use another script to read the response from the file, and parse the JSON content to get only the value I need. Then I added the parameter to the endpoint for the next Test step, say http://www.google.com/$id. However, this failed!
And I tried your code but its showing some error and it is "No property found:json"

Now, how to pass this value as a part of the next test step's endpoint?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2013
04:57 AM
01-09-2013
04:57 AM
If I am getting the scenario correctly, here is a solution I can offer.
make your endpoint url as a variable taken from project/suite property as in
${#Project#PIEndpointURL_REST}
Then, when u capture that id value in variable, define another string variable, and append this id. eg:
def url = context.expand(' ${#Project#PIEndpointURL_REST}')
def temp = url + id
log.info temp
Now as the last step, using groovy script, write this new value back to the project/suite property which is used as endpoint url. Like if u r defining the URl as a testsuite prop, then:
def ts = testRunner.testCase.testSuite.project.testSuites[<yourTestSuiteName>]
tc.setPropertyValue("PIEndpointURL_REST", temp)
Now next json request will take this newly written url with id as its endpoint.
Let me know if it helps.
All the best
Regards,
Ankita
make your endpoint url as a variable taken from project/suite property as in
${#Project#PIEndpointURL_REST}
Then, when u capture that id value in variable, define another string variable, and append this id. eg:
def url = context.expand(' ${#Project#PIEndpointURL_REST}')
def temp = url + id
log.info temp
Now as the last step, using groovy script, write this new value back to the project/suite property which is used as endpoint url. Like if u r defining the URl as a testsuite prop, then:
def ts = testRunner.testCase.testSuite.project.testSuites[<yourTestSuiteName>]
tc.setPropertyValue("PIEndpointURL_REST", temp)
Now next json request will take this newly written url with id as its endpoint.
Let me know if it helps.
All the best
Regards,
Ankita
Ankita
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2017
09:21 PM
11-02-2017
09:21 PM
Ankita, How to add property to test suite?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2018
12:41 AM
12-30-2018
12:41 AM
I have same problem, I have added a property at TestSuite Level but still the test case 2 is getting NULL Value.
${TestSuiteDemo#TokenValue}
I also used ${#TestSuiteDemo#TokenValue} but nouse.. only with in the testcase property transfer is working fine.
Will there be any settings to see and change.
Thank you
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-31-2018
02:52 AM
12-31-2018
02:52 AM
Hi @rbachu1,
You are using incorrect syntax
${#TestSuite#TokenValue}
use above one it will help you out.
Click "Accept as Solution" if my answer has helped,
Remember to give "Kudos" 🙂 ↓↓↓↓↓
Thanks and Regards,
Himanshu Tayal
