Forum Discussion
Say
parameter1 as parameter name and
${#TestCase#PARAMETER1_VALUE} as parameter value.
In your groovy script, set test case level property value to PARAMETER1_VALUE
like
context.testCase.setPropertyValue('PARAMETER1_VALUE', 'value')
Thanks NMRAO for looking into it.
Actually We are creating framework where all the required data like service name, method and input parameters and values comes from external file. I have created excel function to read the data using POI which is working fine. I have attached screenshot that contains my framework setup. Do you see any issue in my code why it is not able to set the parameter and its value?
- nmrao8 years agoChampion Level 3My earlier reply already address that.
Currently there is no value for user name and password. Please add values as property expansion.- ravibabu_it8 years agoOccasional Contributor
I followed your advise but it is not working.I guess I am doing some thing wrong..Can you check the screenshot attached to this thread and please confirm that I am following you correctly..
context.testCase.testSuite.project.testSuites["Services"].testCases[ServiceName].setPropertyValue(inputtagList.getAt(intcount),inputValueList.getAt(intcount))
- ravibabu_it8 years agoOccasional Contributor
Finally I am able to do it by going through RestTestRequestStep API class. Thanks for the user in the below link who has directed me to correct API class.
Incase if any one having same problem, below is the solution i have followed to set REST request parameter values through groovy code..
counter =0;
firstTestStep =context.testCase.testSuite.project.testSuites["Services"].testCases[ServiceName].testSteps[methodname]if(firstTestStep instanceof com.eviware.soapui.impl.wsdl.teststeps.RestTestRequestStep)
{
/def parameters = firstTestStep?.getTestRequest()?.getParams()
// loop through the map parameters
parameters.each { k,v ->
// for each params print the name and the value
def param1="$k"
log.info param1
log.info "value of k is :$k : ${v.getValue()}"
if (counter<tagsize)
{
parameters.setPropertyValue(param1,inputValueArray[counter])
counter++
}
}Thanks,
Ravindra.Ch