agrostar / zzapi-vscode

VS Code extension for zzapi - an API testing and documentation framework
MIT License
3 stars 0 forks source link

Reporting of $size failure can be more accurate #22

Open vasansr opened 1 week ago

vasansr commented 1 week ago

When a $size test fails, we report the expected value as the given count, but we print the entire array as "got". For large arrays, this is inconvenient.

[FAIL] test $.responseData.productGists: expected $size: 60 | got [{...}, {...} ...]

I'd rather see the size of the array that we got:

[FAIL] test $.responseData.productGists: expected $size: 60 | 39

I can always look at the actual result in the output, but counting the number of array elements in the output is hard.

Varun0157 commented 1 week ago

Do we want to do this for all size related clauses ($lt, $gt, $lte, $gte, $eq, $ne) as well as the direct comparison, or only for a direct comparison (i.e., received : expected)?

vasansr commented 1 week ago

Yeah. Essentially, we want to say expected > 5, got 3, or expected == 5, got 7 etc.

The "received" should follow what is expected. If the entire array was expected, the received should also print that. If only the size of the array was expected, we should print the size of the array received.