You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This would be great when asserting explicit bodies, but I think that kind of assertion on data isn't very useful anyway. Annoyingly, orders of objects (map) and even arrays aren't always predictable, so perhaps more Testify style "assert contains" ideas would work?
But this idea also addresses potential security issues (if passwords are sent around), although I'm keen to avoid solving things like that in the early stages.
Ok, one of the main goals would be to start with a known result that can be pasted into the document and then exclude things like timestamps and ids when running the test to avoid common mismatches. I'll play around with something simple with one syntax using a real example, thanks!
Ok, one of the main goals would be to start with a known result that can be pasted into the document and then exclude things like timestamps and ids when running the test to avoid common mismatches. I'll play around with something simple with one syntax using a real example, thanks!
—
Reply to this email directly or view it on GitHub #21 (comment).
As a Tester
I want to Exclude variable data (timestamps, id fields etc.)
So that I can validate things that matter
Proposed feature
Designate a pattern that will be used to "erase" values from both the expected data, and the response.
Possible solutions
Use a special character field / operator to indicate the exclusion, in this example the prefix ! designates a type of expression being provided.
Text Patterns
Substitute using sed style replace, mostly for text.
!s: s/ABCDE/XXXXX/g
Remove data matching regex, in this case a valid email address. Any value matching the regex would be replaced with nothing.
!r: (?:[a-z0-9!#$%&'+/=?^
{|}~-]+(?:.[a-z0-9!#$%&'_+/=?^_
{|}~-]+)|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|[\x01-\x09\x0b\x0c\x0e-\x7f])")@(?:(?:a-z0-9?.)+a-z0-9?|[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|[\x01-\x09\x0b\x0c\x0e-\x7f])+)])JSON Patterns
Replace a field's contents with a dummy value.
!_id: 123
Exclude field from json, the field "_id" field and value would be removed prior to compare.
!x: _id
The text was updated successfully, but these errors were encountered: