-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
should match each fail if the array is empty #2364
Comments
So I actually was not aware of this either. But from a best practice perspective, we should start out with the most important assertions first, such as expected data existing, before moving onto validating the content of that data. Layers of assertions can seem painful, but when it comes to debugging, it can be really helpful to break down the response in this way. Although we do have all-in-one's like |
@ptrthomas Just providing some feedback: This is indeed problematic for me. I just had a CI fail because I didn't pin the karate version (on purpose I think we should use latest).
This (and other tests) started failing w/ 1.4.1.RC3. How do I need to update our tests / schemas to prevent test failures for empty arrays? |
@steve1337 in at least this case, since let me know if you run into more issues, we are open to un-doing this change |
@ptrthomas Thanks for the fast answer. I want to provide and explain my use case / impl a bit more because unfortunately this won't work in this case I have a lot of tests like this
Then my util feature like this
I re-use this pattern in a bunch of places as well. How would you suggest I adjust the code to fit the new changes? I'm not really sure how I would do that because I def want to check the schema once the array is not empty. |
@steve1337 One thing you could do is set object to be optional |
adding a comment for future consideration. I think the ideal solution would be to support this syntax: * match each? actual == expected
* match actual == '#[?] expected' this was assessed to be too complex to implement at this point. there's a TODO comment in the code for
Match.Type is currently an enum and should ideally be a composite object. so we have an explosion of enum values to represent all permutations of core type, deep, each and now this "optional each" concept |
@steve1337 1.4.1.RC4 is available with the change I described two comments above, so you can add |
1.4.1 released |
this has come up a few times and new users run into this a little too often for comfort
I think it is fair that the intent is always to validate more than one item in the array.
example: https://stackoverflow.com/q/60638091/143475
The text was updated successfully, but these errors were encountered: