Testing: How to approach testing
Im trying to write some tests for my ash resources, and want to test errors in particular, is there a recommended way of going about this? The testing docs are a bit anemic, wonder if folks have some strategies here. In particular when matching on ash errors, I have to match on large error structs with the stacktrace. Is there a simplier way of going about this?
5 Replies
Easy hack to get it to work,
This interests me.
Right now we're doing:
and
Seeing better patterns would be useful
Personally, I just do most of the time
but I think we could definitely add some testing helpers, like
assert_has_error
or something like thatHow do you validate on a collection of errors?
This is how I'm currently asserting a collection of errors
Yeah, I think if I was validating on a collection of errors I'd do something similar
but from a testing perspective, I'd probably just do the same thing 3 times and assert that the error message contains what I want each time
instead of one assertion that all 3 things are in the list