Forum Discussion

mmanideep's avatar
mmanideep
New Contributor
4 years ago

How to pass values to json request using groovy script

Hi Team,

 

i am new to soapui - groovy script automation . i am looking for solution to pass values to Json request using groovy script 

I am aware to pass values using custom properties ,but its not useful for my scenario since role permission info(See the below request) has array of values. it might change every time .

can you please suggest the solution to handle this type of scenarios using groovy script.

 

Sample Request : 

{
"id": "",
"name": " ",
"displayName": " ",
"description": " ",
"status": " ",
"updatedby": " ",
"updatedon": " ",
"rolePermission": {
"rolePermissionInfo": [
{
"name": "",
"permission": "",
"centername": "",
"displayname": ""
},
{
"name": "",
"permission": "",
"centername": "",
"displayname": ""
},
{
"name": "",
"permission": "",
"centername": "",
"displayname": ""
}

]
},
"mode": ""
}

2 Replies

  • mmanideep :

     

    You can write custom groovy code to create request at runtime, i don't think of any other possible way of achieving this.

    Let me know in case you need help on writing custom code.

    • mmanideep's avatar
      mmanideep
      New Contributor

      HimanshuTayal 

       

      Thank you for quick response . i am beginner to soapui - groovy automation . can you please help me to write the custom code .

       

      Also please suggest me best site to learn soapui - groovy automation.

       

      thanks.