I am trying to get the Property value and Set it with different value in SoapUI's "REST Request Properties" (NOT the custom properties). It just gives me NULL value
Here is what I did:
1. Get test step object
2. get the property value with name of the property => It is giving me null value.
I know I am getting the correct object as I was able to rename the same Test Step name with following code
def restRequest = testRunner.testCase.getTestStepByName("Test");
def a = restRequest.getPropertyValue("Method")
log.info(a) // this gives null
restRequest.setName("Test1") // This works
In the step
object, there is another object called testRequest from which you can get all those required properties.
For example if you want to get all the properties
log.info step.testRequest.metaClass.methods*.name
For example if you want to know the get methods
log.info step.testRequest.metaClass.methods*.name.findAll {it.startsWith('get')}
Similarly you can get the methods to set the value as well.
For instance, you want to modify Pretty Print
from true
to false
:
step.testRequest.setPrettyPrint(false)
log.info step.testRequest.properties['prettyPrint']
Similarly, you can find the required property name, find the right method to modify the value as per your needs.