Ask a Question

Dynamically adding properties for HTTP Request

Werner_Blueml
Occasional Contributor

Dynamically adding properties for HTTP Request

Hi,

we have HTTP-Requests with different numbers of properties depending on testdata.
Is it possible to add properties dynamicly to a HTTP-Request ?

e.g. A usergroup can have 1 or more members. If there is only one member we need only the properties with ('0') with two members properties with ('0') and ('1') and so on.

productLineModels('0').accessIdentyModel.firstName=Max&
productLineModels('0').accessIdentyModel.lastName=Meier&
productLineModels('0').accessIdentyModel.birthDate=24.01.51&
productLineModels('1').accessIdentyModel.firstName=FNP2Meier&
productLineModels('1').accessIdentyModel.lastName=LNP2Meier&
productLineModels('1').accessIdentyModel.birthDate=18.04.88&
productLineModels('2').accessIdentyModel.firstName=FNP3Meier&
productLineModels('2').accessIdentyModel.lastName=LNP3Meier&
productLineModels('2').accessIdentyModel.birthDate=16.05.55

Is there a way?


We try it in this way... but it didn't work:

groovyUtils.setPropertyValue("registerSelectProduct.action", "myProperty", "Hello World!")


We looking for a method like this.... 

request.addProperty(new Property("name", "value"))

Regards
Werner
1 REPLY 1
SmartBear_Suppo
SmartBear Alumni (Retired)

Hi Werner,

You can try

def testRequest = testRunner.testCase.getTestStepByName("HTTP Test Request").getTestRequest();
testRequest.addProperty(name);
testRequest.setPropertyValue(name, value);

I hope this is what you where looking for.

Regards,

/Dragica
eviware.com

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
cancel
Showing results for 
Search instead for 
Did you mean: