Forum Discussion

krogold's avatar
krogold
Regular Contributor
6 years ago

How a request parameter that was programmatically set can be refreshed ?

 Hello,

 

I'm currently trying to initialize testCases and steps programmatically.

So far, I manage to create the testCase and the testStep from the resource.

I can see from the following code that I have two parameters. I intend to set their value so they can be set dynamically through custom properties

def requestParameters = testStepConfig.config.restRequest.parameters.entryList // equivalent de testStepConfig.getConfig().getRestRequest().getParameters()

expand_prop = false // check if 'expand' property is available, in that case
requestParameters.each {
	e->
	log.info "${e.key} : ${e.value}"
}

I see :

Thu May 03 15:25:44 CEST 2018:INFO:expand :

Thu May 03 15:25:44 CEST 2018:INFO:exclude :

 

Then I build a string that I want to set as a value for a property :build_value = "\$"+"{" +"#TestCase#" + e.key + "}" which gives me:

Thu May 03 15:25:44 CEST 2018:INFO:build value : ${#TestCase#expand}

Thu May 03 15:25:44 CEST 2018:INFO:build value : ${#TestCase#exclude}

 

I do the following command for each parameter:

e.setValue(build_value)

 

If I go again through the loop above, I see :

Thu May 03 15:25:44 CEST 2018:INFO:expand : ${#TestCase#expand}

Thu May 03 15:25:44 CEST 2018:INFO:exclude : ${#TestCase#exclude}

 

Which is what I want, however, when I open my newly created request step, the parameter fields are empty. If I close and reopen ready API, it is the same ...

Does anyone has an idea of why I can't see the parameters value ?

 

thank you

 

Alex

 
 
 
 
No RepliesBe the first to reply