-
Notifications
You must be signed in to change notification settings - Fork 4
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
Start on use-case oriented documentation #38
Conversation
@provegard any thoughts on this style of documenting? |
docs/how-to-assert.md
Outdated
> Avoid matching a collection on its length, as a failure will not give any details on the element(s) that were | ||
> missing or extra. An alternative is to filter a larger list and match on a smaller inline list | ||
> ```scala | ||
> Example? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Difficult if you're after the length...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just provide some tips? E.g.:
- Testing length may be brittle if the producer is modified to create more items - testing that the list contains some and not others (two tests) is likely more stable.
By the way, we could modify toHaveLength
to print the actual list, or at least parts of it (like we need to do with toEqual/toContain).
Very nice! |
Co-Authored-By: Per Rovegård <[email protected]>
I'll merge this to master and we'll keep it up-to-date there on common scenarios. |
What about adding another type of documentation, one that is use-case oriented?
E.g. show how to assert when you have a list. Give tips and tricks both regarding the Intent API as well as practices on writing good tests (regardless of framework)?
I think such a document would serve new users as well as developers new to TDD / testing well. Intention is to showcase common situations and let the API specification (or matchers.md) cover the details.
Related to #27