We come from here: https://github.com/intuit/karate#match-contains-deep
As it states:
This modifies the behavior of match contains so that nested lists or objects are processed for a "deep contains" match, ..., you only want to check for some values in the various "trees" of data
So let's try to play a bit, and find some {e: 5} that will be somewhere deep in the tree, when original = { a: 1, b: 2, c: 3, d: { a: 1, b: 2, e: 5 } }
Feature: Match contains deep
# match contains deep test (works ok, but this is not "deep" by any stretch of imagination, this is guiding the whole path in the search)
Scenario: match contains deep test modified original
* def original = { a: 1, b: 2, c: 3, d: { a: 1, b: 2, e: 5 } }
* def expected = { d: { e: 5 } }
* match original contains deep expected
#Thats was not deep, this is deep (fails, and this is what anyone would understand by "deep")
Scenario: match contains deep
* def original = { a: 1, b: 2, c: 3, d: { a: 1, b: 2, e: 5 } }
* def expected = { e: 5 }
* match original contains deep expected
#So you dont need deep (fails)
Scenario: match contains test modified original without deep
* def original = { a: 1, b: 2, c: 3, d: { a: 1, b: 2, e: 5 } }
* def expected = { d: { e: 5 } }
* match original contains expected
#So maybe it works with any (fails)
Scenario: match contains test modified original
* def original = { a: 1, b: 2, c: 3, d: { a: 1, b: 2, e: 5 } }
* def expected = { e: 5 }
* match original contains any expected
#Maybe I'm tripping with syntax (fails)
Scenario: match contains deep test my test #2
* def original = { a: 1, b: 2, c: 3, d: { a: 1, b: 2, e: 5 } }
* def expected = e: 5
* match original contains deep expected
#So maybe I'm tripping with syntax and semantics, and its any (fails)
Scenario: match contains deep test my test #2
* def original = { a: 1, b: 2, c: 3, d: { a: 1, b: 2, e: 5 } }
* def expected = e: 5
* match original contains any expected
So, either I'm not really getting the thing, or it doesn't work as one would expect, i.e. I would like to check an existing key-value pair placed anywhere in the tree.
If someone can throw some light at it, that would be great. As I can see @PeterThomas is answering most of the questions tagged with Karate, I want to thank him for the great effort on putting this tool in the hands of the community.