Is there anyway to parameterize a REST APIs Query PARMS?
Hi,
I've been trying to find alternative ways around the same problem - and I asked a similar question today but perhaps from a different perspective - so I apologise if this appears to be the same post although I dont think it is.
Oh - Ive just reread the other post - and it looks like i did ask virtually the same question - but I was rambling a lot and dont think I was very clear in my question - this I think is a lot clearer than my original post
If you look at the image above - you can see I tried parameterizing the REST QUERY PARM NAME value using a custom property I'd created on the testcase.
It didn't work - is there anyway to parameterize the actual name of the parm?
thanks - it seems a bit rubbish that you cant parameterize the parm name - there must be a way to do it .
can anyone steer me in the right direction?
thanks to all!
richie
Hi richie,
It should work but it is not ${TestCase#value} but ${#TestCase#value}.
ReadyApi has the following rules:
1. If you define the scope you put a # in front of it like in: {#TestCase#...}, {#Project#...} or ${#TestSuite#...}
2. If you are reffering to a test step you use it without a # like in ${GetSessionId#...}
Cheers!
using groovy we can add parameters at run time.kindly, try the below code snippet:-
*********************************************************************
def step=testRunner.testCase.getTestStepByName("REST")
def req=step.httpRequest
req.removeProperty("name")
req.getParams().each{
log.info it.value.name
}//required to add field before setting the value
req.addProperty("name")// set the new field value
req.setPropertyValue("name","abc")******************************************************************
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.