Forum Discussion

vpachpute1's avatar
vpachpute1
Frequent Contributor
9 years ago

Groovy script to write custom property values into xml requests

Hi

 

Actually I want to write custom properties values into xml request files using Groovy Script.

 

Following is my request. I want to write ${#Project#MSISDN_GB} and ${#TestSuite#usergroup} property values inside xml request.

<test">
    <addug>
            <charging-id type="msisdn">${#Project#MSISDN_GB}</charging-id>
            <ug>
                <usergroup>${#TestSuite#usergroup}</usergroup>
            </ug>
        </addug>
</test>

 

Can anyone please provide me sample script to do this. Thanks in advance. !!!

 

Regards

Vishal

 

  • nmrao's avatar
    nmrao
    Icon for Champion Level 2 rankChampion Level 2
    Why do you even write or use groovy script? It should be fine as long as the request in the request step appears as you have shown (with property expansions), soapui automatically sends request by replacing those values.

    Or completely misunderstood your case.
    • vpachpute1's avatar
      vpachpute1
      Frequent Contributor

      Hi

       

      Actually my project requirement is as

      1. Pass the request using using external .xml file. (So that going forward, if there is any change in request, needs to change in one place rather than changing in each test case. )

      2. So in that request, MSISDN should be dynamic and test data should be passed as per requirement.

       

      But while sending request using file, parameterised property value is not called. So i want to write Groovy script to first write into xml file with parameter values and call this file into script.

       

      Please refer to

      https://community.smartbear.com/t5/SoapUI-NG/Custom-property-value-is-not-called-in-parameterised-request/m-p/134940#M30684

       

      Regards

      Vishal

      • vpachpute1's avatar
        vpachpute1
        Frequent Contributor

        Hi

         

        Can anyone please help me on the same

         

        Regards

        Vishal