Forum Discussion

connectnishant's avatar
connectnishant
New Contributor
5 years ago

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 mappi...
  • HimanshuTayal's avatar
    HimanshuTayal
    5 years ago

    connectnishant :

     

    What you can do is pass phone number with "," separated like 1111111,2222222,333333,444444

     

    and then split your number with comma in groovy and create dynamic request with number size.

     

    //Get phone Number with , seperated from Excel sheet
    def phoneNumber = excelsheet(phone__number);
    
    //Split phone number with ,
    int phoneNumberSplit = phoneNumber.split(",")
    //loop the number of phone number
    for(int i = 0 ; i < phoneNumberSplit.size() ; i++){
    //generate dynamic request
    // Create your dynamic request with phoneNumberSplit[i]
    }

     

    Let me know if you need more help on this.