I am new to this tool and reading the reference documentation, but trying it tricky to handle in one my use cases.
I have a CSV file with 7 columns and 100 rows of data And I have an API which gives me a list response with the same list data
I want to assert on my API response which say has an id as a primary key and check if all other values for that id match with the csv
Csv file: *test.csv*
id,date,fullname,cost,country,code
1,02-03-2002,user1,$200,Canada,CAN
2, 04-05-2016,user2,$1500,United States, USA
API Response:
[
{
"id":1,
"date":"02-03-2002",
"fullname": "user1",
"cost": "$200",
"country": {
"name": "Canada",
"code": "CAN"
}
},
.....
]
I tried with
- def csvData = read(test.csv)
and later was using
- match each response contains csvData
I am struggling to find a way to match rest other fields from API list response with csv. I want to go through one by one based on the id since it is the primary key and will be available in both and assert for a given id other fields are matching.
Sorry for opening it again: peterthomas: the suggested answer has data driven scenarios. May be I think, I was wrong with my question, I can read the csv first and get it in a variable , then hit the api and get the response too. Now I have to compare each value of my csv data whichs in a variable with the response based on matching ids in my case.. so condition of matching each id and the other values corresponding to that id with the response and it's values