Reputation: 41
Rest assured api automation-how to post big json payload in body with few parameters or dynamic data .
xxxx is the data need to be passed dynamically with every post request. It can be from csv file or some random data.
{
Id:xxxx
Name:test123
City:Edison
Profile :{
Startdate: xxxx
Enddate:xxxx
Product: abcd
}
Renewal: {
Auto renewal: yes
Term: 1 year
}
}
Upvotes: 0
Views: 2195
Reputation: 5917
Rest-Assured supports many ways to deal with json payload
String
: not good for this situationMap
: for simple and not too much key-value pairPOJPO
: the main option hereFor your case, I would recommend the POJO approach.
More infomation here: https://github.com/rest-assured/rest-assured/wiki/Usage#serialization
For the part: It can be from csv file or some random data.
--> it can be easily achieved by supporting from Test framework (Junit5 or TestNG)
Upvotes: 0