Forum Discussion

connectnishant's avatar
connectnishant
New Contributor
5 years ago
Solved

Dynamic Rest request creation for an update payload

I have a requirement to test an update request which can update more than 1 phone number. 

I am using a data driven framework, and was passing the values from excel with 1 to 1 request element mapping.

however in this case, I have to test cases where there can be one number/2 numbers to update/ so and so forth.

This is not possible with my current framework, hence i need some help in a way to create this request dynamically. 

I am thinking of a way in which if the data excel data sheet has a column with number of phones to update as 3, my request should be created with 3 phonenumbers. The phone number array has multiple elements: 

{

phoneNumber1

PhoneType1

extension1

contactPreference1

etc

}

{

phoneNumber2

PhoneType2

extension2

contactPreference2

etc

}

{

phoneNumber3

PhoneType3

extension3

contactPreference3

etc

}

I am very new to Groovy and any help would be greatly appreciated. Using Groovy, if we can create a requst, I would also need help in passing that to my actual request step in the framework.

 

Please help.