cancel
Showing results for 
Search instead for 
Did you mean: 

Modifying REST request query via groovy script

Highlighted
Contributor

Modifying REST request query via groovy script

anyone tried to modify request query via groovy script?

i am trying to pass empty data to query, and still gets rendered to the final request url.

3 REPLIES 3
Highlighted
Moderator

Re: Modifying REST request query via groovy script

Hi Axel,

 

Can you provide the script which you use?



Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Highlighted
Contributor

Re: Modifying REST request query via groovy script

i found a way to modify the request of a teststep using a groovy script

 

 

def testStep = context.testCase.getTestStepByName('My test step name')
for (def testCaseProp in testStep.getPropertyList()) {
   testCaseProp.setValue()
}

 

 

but, is there a better way? I want to modify the request queries of other teststeps.

Highlighted
Super Contributor

Re: Modifying REST request query via groovy script

You have an optional query parameter that should not be in the request URL if blank?

Was the parameter set as required in the method viewer?

 

In many requests you can set the parameter value to equal a property like ${#TestCase#PropertyName}

Then you can change the test case property to update all those tests.

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors