cancel
Showing results for 
Search instead for 
Did you mean: 

Using A Transferred Parameter in a Test Step Request (REST)

SOLVED
Highlighted
Contributor

Using A Transferred Parameter in a Test Step Request (REST)

Hi,

I appear to have successfully passed a parameter from Test Step1 to Test Step2 using the Property Transfer capability. However, I cannot figure out how to use the parameter in the request of Test Step2.

 

Here is how I set up the transfer:

Screen Shot 2016-01-06 at 4.06.50 PM.png

 

Below is the Test Step receiving the parameter "planId":

Screen Shot 2016-01-06 at 4.09.07 PM.png

I had assumed that since I passed the param from the CreatePID response to the UpdatePIDComment request (as per first screenshot), it would have appended the planId value to the UpdatePIDComment endpoint (i.e., http://localhost:8080/UpdatePIDComment?planId=whatever), but it is not working (when it doesn't work you see that "No PlanId passed to UpdatePIDComment. Doing nothing." as shown in the response window in UpdatePIDComment.

 

I can't figure out what to do, and I would be very grateful for any help. Thank you.

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Contributor

Re: Using A Transferred Parameter in a Test Step Request (REST)

Looks good, can you try something similar to this now in the property transfer step: (Soap Request is your CreatePID step).

 

PlanID - Transfer.PNG

View solution in original post

Highlighted
Contributor

Re: Using A Transferred Parameter in a Test Step Request (REST)

ok, your last reply got the Property Transfer step to appear to work properly when I run the step stand-alone (see valid output below):

Screen Shot 2016-01-07 at 1.07.38 PM.png

However, something still must be missing, because when I run the entire test case, the step that needs the planId as input (UPdatePIDComment) is generating an output essentially indicating a failure message (i.e., that the planId never was sent as the expected parameter in its request) (see below):

Screen Shot 2016-01-07 at 1.10.25 PM.png

So, seems to be something still not working in the transfer or something. Thanks for all your help!

 

View solution in original post

13 REPLIES 13
Highlighted
Community Hero

Re: Using A Transferred Parameter in a Test Step Request (REST)

Highlighted
Community Hero

Re: Using A Transferred Parameter in a Test Step Request (REST)

Highlighted
Contributor

Re: Using A Transferred Parameter in a Test Step Request (REST)

I've had some luck with the settings displayed in the attached screenshot. If you want to give it a try.

 

TransferringProperty.PNG

 

You'll need to select EndPoint as the target property and update the Source XPath with the location of the PlanID from your CreatePID response.

Highlighted
Contributor

Re: Using A Transferred Parameter in a Test Step Request (REST)

Hi Simon, tried to do what you did(with the endpoint as property and entering that concat string) , but got the following error (see below). Any ideas? Thanks!

 

Screen Shot 2016-01-07 at 10.03.42 AM.png

Highlighted
Contributor

Re: Using A Transferred Parameter in a Test Step Request (REST)

You will need to click the expression prompt icon next to Path langauge: XPath - then click the XML Value you want from the CreatePID step as I believe v1:PlanID will not be the actual XPath expression you want to use.

 

When you do this, the real expression will look something more like this:

 

declare namespace v1='http://schema.co.uk/createPID/v1';
//v1:CreatePIDResponse[1]/v1:PlanID[1]

 

When you do this, the concat function will disappear and be replaced with the XPath expression, then re-add this again  which might end up looking like this:

 

declare namespace v1='http://schema.co.uk/createPID/v1';
concat('http://localhost:8080/UpdatePIDComment?planID=', //v1:CreatePIDResponse[1]/v1:PlanID[1])

 

Let me know if you have any issues with the above.

Highlighted
Contributor

Re: Using A Transferred Parameter in a Test Step Request (REST)

Hi Simon, I have Xpath selection as per below:

Screen Shot 2016-01-07 at 10.48.31 AM.png

 

However, when you say "then click the XML Value you want from the CreatePID step",  I am not sure what I click where to get the expression you are referring to. Could you possibly clarify? Is it something I do from the CreatePID step (shown below)?:

Screen Shot 2016-01-07 at 10.54.11 AM.png

 

Thanks for your patience

Highlighted
Contributor

Re: Using A Transferred Parameter in a Test Step Request (REST)

No worries.

 

If you click the button next to that, the button circled in blue below:

 

XPathExpressionButton.PNG

 

Then, select the XPath Value you want from the pop up and click OK:

 

XPathExpressionList.PNG

 

This should leave you with the actual XPath expression you need to concat with te localhost end point.

Highlighted
Contributor

Re: Using A Transferred Parameter in a Test Step Request (REST)

Ahh, however, I cannot click that button, as it appears disabled/greyed-out (see below). As the yellow dwell might be implying, is mine greyed-out because the specified property (planid) does not have an XML value?  

Screen Shot 2016-01-07 at 11.40.43 AM.png

In other words, am I missing something from the CreatePID step? The planId is actually returned in the header (looks like the below). If so, I can always modify the response output to return differently, or whatever:

Screen Shot 2016-01-07 at 11.45.30 AM.png

Thanks again, Tim

 

Highlighted
Contributor

Re: Using A Transferred Parameter in a Test Step Request (REST)

ok, thinking that the problem was that I was not returning actual xml in response, I modified response. Now, you see below in xml response to CreatePID. However, the button is still greyed-out on the Property Transfer step... Thanks for any ideas!

Screen Shot 2016-01-07 at 12.09.01 PM.png

New Here?
Join us and watch the welcome video:
Top Kudoed Authors