Reputation: 250
I am trying to take some values from json and compare with array.
Feature: sample
Scenario: Sample scenario
* def exp = {"firstname":"AAAA", "lastName":"XXXX"}
* def actual = ['AAAA','XXXX']
* match actual == [exp.firstname,exp.lastName]
# I get error: path: $[0], actual: 'AAAA', expected: 'exp.firstname'
# However Below code works fine
* def arr = [exp.firstname,exp.lastName]
* match actual == arr # Works fine
Is it as expected ? is match not supporting making inline array ?
Upvotes: 1
Views: 144
Reputation: 58058
Read this section of the docs carefully: https://github.com/intuit/karate#enclosed-javascript
* match actual == ([exp.firstname, exp.lastName])
* match actual == [ '#(exp.firstname)', '#(exp.lastName)' ]
Upvotes: 1