Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CollectionAssert size checker failure messages are not verbose enough #441

Closed
lorand-tatar opened this issue Oct 20, 2017 · 0 comments
Labels
Milestone

Comments

@lorand-tatar
Copy link

@lorand-tatar lorand-tatar commented Oct 20, 2017

Using CollectionAssert in a testmatcher in case of failure returns a message something like this:

Failed tests:
  ContractVerifierTest.validate_myScenarioMethod:91 The size <10> is not less or equal to <9>

In its current form it's hard to instantly tell where/what the issue is.
I'd propose at least to add the JSON path when it is used via a stubMatcher or a testMatcher.
E.g.

  ContractVerifierTest.validate_myScenarioMethod:91 In $.myHighLevelArray[0].myLowLevelArrayName the number of elements (<10>) is not less or equal to <9> as expected

Used a contract whose response part looks something like this:

    response {
        status 200
        body(
        '''
{ "myHighLevelArrayName": [
        "myLowLevelArrayName": [
           {
               "myElementKey": "elementValue1"
           },
           {
               "myElementKey": "elementValue2"
           },
           {
               "myElementKey": "elementValue3"
           },
           {
               "myElementKey": "elementValue4"
           },
           {
               "myElementKey": "elementValue5"
           },
           {
               "myElementKey": "elementValue6"
           },
           {
               "myElementKey": "elementValue7"
           },
           {
               "myElementKey": "elementValue8"
           },
           {
               "myElementKey": "elementValue9"
           }
        ]
        _...some other json content..._
    ]
}
        '''
        )
        testMatchers {
            jsonPath("\$.myHighLevelArray[0].myLowLevelArrayName", byType {
                maxOccurrence(9)
            })
        }
        headers {
            contentType(applicationJson())
        }
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.