HTTP Request test step - dynamic url update from previous test step response url property value?
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
HTTP Request test step - dynamic url update from previous test step response url property value?
Please, could someone help me with updating HTTP Request test step url automatically with the value from the previous REST Request test step response?
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I will help you with that. Just let me know how the response looks like so I know how we can extract the url.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
{
"applicationResponse" : {
"header" : {
"status" : "OK"
},
"response" : {
"state" : "WAITING",
"url" : "https://test.3dsecure.gpwebpay.com/csob/order.do?MERCHANTNUMBER=53270203&OPERATION=CREATE_ORDER&ORDE..."
}
},
"errorCode" : 0,
"macToken" : "nlbyrLHXBF",
"serverContacted" : true
}
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you set up a property transfer step to pull that from the respose and store it in a properties step? Then you can set the URL of the next test step to ${Properties#ResponseURL} to reference the URL with property expansion. That might be the easiest way, or you can get a bit more complex with groovy.
---
Click the Accept as Solution button if my answer has helped, and remember to give kudos where appropriate too!
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The following steps can be taken to achieve your goal:
1. Click on the test case from where your request is extracted;
2. Add a custom property called 'Url' (see below picture);
3. Add a Property Transfer test step in your test case;
4. Click on the Property Transfer step and configure it like shown in the image below. The source step is the step from where you want the url to be extracted.
Now the url can be used in other requests. In order to do it just write this instead of the normal url: ${#TestCase#Url}
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A property transfer step works well. Trouble is with the HTTP Request step. The Run button (green triangle) is grey.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can we see a screenshot of the step you are referencing the URL in so we can double check it? And of the property transfer step too. The more details we can see the better. 🙂
---
Click the Accept as Solution button if my answer has helped, and remember to give kudos where appropriate too!
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Click on the HTTP test step and look into the navigation bar for 'HTTP Request Properties'. Look for the 'Endpoint' property and make sure the value is not empty.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Property Transfer works the same way in my SoapUI, but HTTP Request does not work the way you demonstrate. Weird! I use ReadyAPI 2.4.0 version SoapUI Pro. When I put ${#TestCase#Url} into the "Request url" field, I cannot run the HTTP Request. It says there is no url, see in the pictures!TestCaseCustomPropertyUrl
HTTPRequestEditor
HTTPRequestNoEndpoint
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So this is one of those instances where the required test step (HTTP request) does not appear to support property expansion. You could put in a groovy script test step that sets the endpoint from the URL in the test case. I am not directly sure if that's possible, but I am looking into it.
UPDATE: Of course I found the answer after I posted. Try putting this into a groovy test step:
def URL = context.expand( '${#TestCase#URL}' ) context.testCase.testSteps["HTTP Request"].setPropertyValue("EndPoint", URL);
---
Click the Accept as Solution button if my answer has helped, and remember to give kudos where appropriate too!
