question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Match contains does exact matching 0.9.6.RC3+ for nested json and nested list ordering as opposed to 0.9.5

See original GitHub issue

The following are passing on 0.9.5:

Feature: match_contains

    Scenario: Deeply nested contains used to work in 0.9.5 but in 0.9.6 seems to require all fields to be present
      Given def message =
      """
          {
              "correlationId": "101",
              "text": "Hello to everyone",
              "data": {
                  "deeply": {
                      "nested": "no",
                      "id": "1010"
                  }
              }
          }
          """
      Then match message contains { text: "Hello to everyone" }
      Then match message contains { data: { deeply: { nested: "no" } } } }



  Scenario: Match contains for sublist works even if simple list elements are reversed
    Given def message =
      """
      {
          order_id: 5,
          products: [100,101]
      }
      """
    Then match message contains { order_id: 5, products: [101, 100] }


  Scenario: Match contains for sublist works even if complex list elements are reversed
    Given def message =
      """
      {
          order_id: 5,
          products: [
            { product_id: 100, name: "bicycle" },
            { product_id: 101, name: "car" }
          ]
      }
      """
    Then match message contains
      """
      {
          order_id: 5,
          products: [
            { product_id: 101, name: "car" },
            { product_id: 100, name: "bicycle" }
          ]
      }
      """

0.9.6.RC3 + Latest develop (as of an hour ago or so)

Scenario 1:

match_contains.feature:22 - path: $.data.deeply, actual: {nested=no, id=1010}, expected: {nested=no}, reason: actual value has 1 more key(s) than expected: {id=1010}

Scenario 2:

21:15:30.173 [ForkJoinPool-1-worker-3] ERROR com.intuit.karate - assertion failed: path: $.products[0], actual: 100, expected: 101, reason: [path: $.products[0], actual: 100, expected: 101, reason: not equal (Integer)]

match_contains.feature:29 - path: $.products[0], actual: 100, expected: 101, reason: [path: $.products[0], actual: 100, expected: 101, reason: not equal (Integer)]

Scenario 3 equivalent of 2.

I have reproduced this here: https://github.com/KostasKgr/karate-issues/blob/match_contains_issues/src/test/java/examples/match_contains.feature

The above is with 0.9.5, tried with 0.9.6.RC3 and 2.0.0 which i hopefully built correctly from latest develop.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
ptrthomascommented, Jul 13, 2020

@KostasKgr the rhs comes into the picture for the “docstring” variation. it will be null as a capturing group but will be set from karate internals (the stuff between the triple-quotes), I think I’ll leave as it is now

1reaction
KostasKgrcommented, Jul 13, 2020

All three scenarios I had posted pass with latest develop, cheers

Read more comments on GitHub >

github_iconTop Results From Across the Web

Match contains does exact matching 0.9.6.RC3+ for nested ...
Match contains does exact matching 0.9.6.RC3+ for nested json and nested list ordering as opposed to 0.9.5 #1217.
Read more >
com.intuit.karate:karate-apache 0.9.6 on Maven - Libraries.io
Karate is the only open-source tool to combine API test-automation, mocks, performance-testing and even UI automation into a single, ...
Read more >
Release Notes — Dropwizard
Added support for Joda Time DateTime arguments and results when using JDBI. Added configuration option to include Exception stack-traces when logging to syslog....
Read more >
Package List — Spack 0.20.0.dev0 documentation
This is a list of things you can install using Spack. ... system that allows a user to easily construct complex nested solvers...
Read more >
[fedora-arm] arm rawhide report: 20150721 changes
... PackageKit-Qt-0.9.5-3.fc23 Qt support library for PackageKit New ... package: bytelist-1.0.8-10.fc23 A java library for lists of bytes ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found