Toot

Written by Henrik Jernevad on 2024-11-19 at 06:13

Only mock your own interfaces. That is one of my rules of thumb for writing robust unit tests.

When you mock/stub third-party interfaces, you will encode your expectation of what the real component would do, which may differ from what it would actually do. If you failed to anticipate the correct behavior when you wrote the code under test, you will likely encode that same incorrect behavior in your mock.

https://henko.net/blog/only-mock-your-own-interfaces/

[#]programming #unittesting #testing

=> More informations about this toot | View the thread | More toots from henrikjernevad@mastodon.social

Mentions

Tags

=> View programming tag | View unittesting tag | View testing tag

Proxy Information
Original URL
gemini://mastogem.picasoft.net/toot/113508144789528323
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
227.165513 milliseconds
Gemini-to-HTML Time
0.782926 milliseconds

This content has been proxied by September (3851b).