空手道 API , 2 个不同的反应匹配

Karate API , 2 different responses matching

我有以下场景,我希望第一个或第二个响应匹配(*def 第一个或 *def 第二个)。任何一个回应都很好。以下对我不起作用。你能帮忙吗?

场景:A

Given path 'api/..../0.1/..../availability'
* def futureDate = Java.type('uk.co.vw.api.StringUtil').getFutureDate()
* def first = {"available":'#boolean',"collection":'#boolean',"date":#(futureDate),"lift":'#boolean',"bookingAvailability":'#array',"times":'#array',"loan":'#boolean',"delivery":'#boolean' }
* def second = {"code": "#string","message": "#string"}
  And params {dealerNumber: '00111', date: #(futureDate), serviceCodes: 'MIN:1.4,OER:0.85', mot: 0, postcode: "W2", waitingjob: 0 }
When method get
Then status 200
  And match response contains any (first, second)

有两个可能的修复方法。

日期的值设置为变量futureDate。你有这么写的#(futureDate) 应该是这样的'#(futureDate)'

你可以试试这个作为断言

And match response[*] contains (second)
   And match response[*] contains (first)