Open thedodobird2 opened 5 years ago
This would be an improvement, unfortunately it requires a complete rewrite.
A) The objects in the array might have more then one level. A missing element on top-level more important then on a deeper level. Therefore we would have to switch from a depth-first to a breath-first search. B) As soon as there is a misfit an error is thrown, the search is aborted. Gathering errors adds complexity and leads to worse performance. On JSON arrays of reasonable size this shouldn't be an issue, nevertheless it might be one.
When a JsonGauge checks a list of elements for a certain element using
containsElementFitting
, but doesn't fit any (for multiple reasons), the error message isn't very helpful. For example: The name attribute is only correct for one element in the list BUT another attribute of that 'correct' element does not match. This puts it on the same level and your gauge will just say it couldn't find a matching element. Even though there is one that is quite like it.Proposal:
Imagine the JSON array would be
And the following test would be used
Then it would fail with
But preferably it would be