I have two jsonArrays which have keys with different name and I want to compare each json object in a separate feature file.
Is there any way I can pass two jsonArrays in a feature file and compare them.
sample-create.feature
* table kittens1
| name | age | dept|
| 'Bob' | 2 | IT. |
| 'Wild' | 1 | HR. |
| 'Nyan' | 3 |ADMIN|
* table kittens2
| first_name | emp_age |
| 'Bob' | "2" |
| 'Wild' | "1" |
| 'Nyan' | "3" |
* def result = call read('cat-create.feature') kittens1 kittens2
cat-create.feature
@ignore
Feature:
Scenario:
assert first_name == name
assert parseInt(emp_age) == age
I am not able to pass jsonObject from both jsonArrays in another (cat-create.feature) feature file.
Is there any other way to achieve this?
The mistake you are making is
callonly takes one argument. Also note that any variables before thecallare "visible" in the called feature. So you may already have what you want.That said, I think you are over-complicating things and perhaps not yet appreciated the power of Karate and JSON arrays. I think the below will achieve what you want, without an extra
Feature:orcall.Please spend time reading these answers for more explanation of the above: https://stackoverflow.com/a/53120851/143475 | https://stackoverflow.com/a/76091034/143475