cancel
Showing results for 
Search instead for 
Did you mean: 

Set the value of a test case property on xpath in property transfer

SOLVED
Highlighted
Contributor

Set the value of a test case property on xpath in property transfer

I m trying to add a property transfer from rest response to a test case level custom property. From rest response, I want to exact 'id' by 'name' and set the value as test case level property
My XPath is as follows 

//*:e[*:name = '${#TestCase#CLContractName}']/*:id

But this is returning null 
If I directly set the value then it's setting the value correctly 

//*:e[*:name = 'BY-12223']/*:id

My sample xml as follows 

<Response xmlns="https://training-app.labs.com/api/v1/investor">
<items>
<e>
<id>48223</id>
<name>LAI-00151007</name>
<amount>25050.0</amount>
<interest_rate>25.99</interest_rate>
<term>60</term>
</e>
<e>
<id>48262</id>
<name>LAI-00152581</name>
<amount>44225.0</amount>
<interest_rate>18.9</interest_rate>
<term>36</term>
</items>
<total_count>13</total_count>
</Response>


Please advise me what is the correct format and what I am doing wrong here? Thanks 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Hero

Re: Set the value of a test case property on xpath in property transfer

Hey,

 

I just tried to set a value as you did and it worked for me.

 

Are you sure that the property is called CLContractName?

What version of ReadyApi do you use?

Probably not relevant but BY-12223 doesn't exist in your sample xml.



If my answer helped please click on the 'Accept as Solution' button.

View solution in original post

6 REPLIES 6
Highlighted
Community Hero

Re: Set the value of a test case property on xpath in property transfer

Hey,

 

I just tried to set a value as you did and it worked for me.

 

Are you sure that the property is called CLContractName?

What version of ReadyApi do you use?

Probably not relevant but BY-12223 doesn't exist in your sample xml.



If my answer helped please click on the 'Accept as Solution' button.

View solution in original post

Highlighted
Community Manager

Re: Set the value of a test case property on xpath in property transfer

Hi @mpw83,

Could you please let us know if you still need assistance on this question?

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Highlighted
Contributor

Re: Set the value of a test case property on xpath in property transfer

@Lucian  Thanks. The mentioned way is the correct way to set the property value. After the investigation, I found that I am getting null because the test case property value is empty otherwise its correct

    //*:e[*:name = '${#TestCase#CLContractName}']/*:id

 

Highlighted
Contributor

Re: Set the value of a test case property on xpath in property transfer

@TanyaGorbunova Thanks, I don't need any further help regarding this issue . 

Highlighted
Community Manager

Re: Set the value of a test case property on xpath in property transfer

Happy to hear that the issue was resolved, @mpw83  🙂

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Highlighted
Community Hero

Re: Set the value of a test case property on xpath in property transfer

Well it's nice that you figured it out. 😄



If my answer helped please click on the 'Accept as Solution' button.
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors