Inserting particular Json Key value in a Json body pulled from Oracle DB

68 views Asked by At

Lets say i have a sample Json Request Body stored in an Oracle DB which i'll be using it multiple times in Java code(Doing POST method using RestAssured)

Sample json Req. Ex:

 xxxRequest{
          yyyDetails{
               "accountId": "????",
               "Action": "Add",
               "Address": "Brandon valley",
               "PinCode": "12356",
                    }
                }

Scenario: Saying i've 50 different TestCases where i'll be using this same Json Request. But only the value of "accountId" alone changes for all 50 TCs.

Once i connect with DB, storing this Json request in a String, I need to change the "accountId" key's value alone each time before i do POST method.

Note: I tried splitting the String into two and add my required AccountID value everytime. Wanted to know if there's any other better way to make it simple.

1

There are 1 answers

1
sivaganesh sivakumar On BEST ANSWER

Have your accountid value hardcoded to something like "ACCOUNTID" and replace the value each time you send a specific request