I have scenario like I need to add highlighted json field to Request. Can anyone please help me in this.
Use JsonSlurper and JsonBuilder, they are Groovy classes for working with JSON and are already available in SoapUI.
import groovy.json.* def request = new JsonSlurper().parseText(<your request JSON here>) // Deserialize JSON request to an object request.putAt("generationTime", "2016-01-26T16:07:07Z") // Add your new field def requestStr = new JsonBuilder(request).toString() // or toPrettyString(); this serializes the object back to JSON
I have 200 Test cases, That's have differenent types of test data. How can I handle this, What I am looking for is
I have to write a script that has to update all the request, with generation time field,
So you need to do this in 200 separate test cases? I don't know of a way you could do this without adding this script to all of them. You might be able to make it work using an event listener but it would be a little hacky.
Thanks for the help, Actually what is the scenario is, Dev team added extra field to the RQ, We have test cases 12, test steps are more than 1500, It is difficult to update each Test step to the test case, That's why I want to Automate this process. Please help me in this.
Here is the steps for scenario,
1. I have a test case in that I have 1500 test steps(RQ).
2. I need to add the Generation time field to each RQ.
3. Is there any way to display in the RQ that field.
Thanks in Adavance.
Thank you for your replies, everyone!
@maddenapally, have you managed to find a solution? If not, could you please describe the stage you are on now?