is there a way to set custom property using groovy in ready API

1.3k Views Asked by At

I am getting 'EmployeeID' Value from one of my API Response using groovy. Now i want to set that value in custom properties using groovy so that i can reuse it in my post API Calls. Is there a way we can achieve this in ready API or using groovy script

1

There are 1 best solutions below

1
On

Yes you can, it depends at which level you want to set your property

testRunner.testCase.setPropertyValue("my_prop", my_value) // at test case level
testRunner.testCase.testSuite.setPropertyValue("my_prop", my_value) // at test suite level
testRunner.testCase.testSuite.project.setPropertyValue("my_prop", my_value) // at project level

note that "my_value" must be a string, so you may need to cast it : my_value.toString()