Forum Discussion

Telmore_A_S_Sup's avatar
Telmore_A_S_Sup
New Contributor
13 years ago

Adding multiple values to the same property.

Hi,

I have a question - as I'm struggling to get this working.
I'm working with REST calls..
In this particular case I need to transfer 2 values to the property {NAME} - in the following URL: Http://someurl.com/common-api/cpr/cpr.svc/cpr/{CPR}/validity?name={NAME}

I need to parse a first name & a last name to the property {NAME} with a spacing in between - the order is of cause of importance, since I want the first name, first in the property.
These values I have from a XML response I get from a earlier REST call, that provide me a XML similar to this(stripped it down for simplicity):
<CPR>
<First_Name>Niels</First_Name>
<Last_Name>Holm</Last_Name>
</CPR>

Do I have to create a new property test step - where I transfer the values too? In that case - how do I transfer first and last name with spacing?
Or can I do it directly to the test step where I need the first and last name?

Been trying to find information on this matter - but haven't been able.

Any help is appreciated.
  • Hi,

    You can easily concatenate two properties in order to solve your problem. Let's say, for instance, that you have two project-level properties; "foo" (with the value "good"), and "bar" (with the value "bye"). If you expand them like this

    ${#Project#foo}${#Project#bar}

    SoapUI will concatenate the values, producing "goodbye".

    In your case, you can use property expansion in your request (right click -> get data) to get First_Name from your XML response. Then, insert a space, and simply use the same syntax to expand Last_Name. This should give you NAME in the format you need.

    Hope this is of use to you!

    Regards,

    Arian
    SmartBear Sweden