I want to to be able to check two conditions if they are true i.e in karate I have an array of data that I want to validate in the following way
if "Documentation": "ID" then "citizen": "YES"
else
if "Documentation": "Passport" then "citizen": "NO"
Here is the array data I want to validate
{
"id": 7777,
"name": "suzie",
"surname": "Nedbank",
"Documentation": "ID",
"citizen": "YES",
},
tried approach:
* def Doc_type = function(x) { return x == "ID" || x == "Passport"}
* match response ==
{
"id": 7777,
"name": "suzie",
"surname": "Nedbank",
"Documentation": "#? Device_type(_)",
"citizen": "#($.Documentation == "ID" ? "citizen" : "YES" || $.Documentation == "Passport" ? "citizen" : "NO" )"
}
error : net.minidev.json.parser.ParseException: Unexpected token | at position 154.
Aucun commentaire:
Enregistrer un commentaire