Forum Discussion

testtesttest88's avatar
6 years ago

Merging of Multiple Properties

I have a series of fields that are used repeatedly throughout my project. Some of which are combined to create new fields:

 

FirstName: James

LastName: Dean

 

If I want to combine these properties to create a new property 'Name', how can this be done?

 

Would creating a new property called: Name

with the value: ${FirstName}&' '&${LastName}

work?

 

I want 'James Dean' to be given in the request.

 

Any answers gratefully received.

 

Thanks

1 Reply

  • You could use property expansion like this ${#Project#firstname}, basically #Project or TestSuite or TestCase#<propertyname>, see also here click me.

     

    So if the fields are set on the project itself, use it like this:

    <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
       <soap:Header/>
       <soap:Body>
          <name>${#Project#firstname} ${#Project#lastname}</name>
       </soap:Body>
    </soap:Envelope>

    This will result in request looking like this:

    <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
       <soap:Header/>
       <soap:Body>
          <name>James Dean</name>
       </soap:Body>
    </soap:Envelope>

    In groovy script it is slightly more convoluted, as you have to type context.expand('${#Project#firstname}').