Hacker News new | past | comments | ask | show | jobs | submit login

Came here to say exactly that. The author is advocating for mockist style of unit testing, which is quite terrible for many, many reasons. What you are describing is classic unit testing, and this is the way to go.

Good article and book about it:

- https://enterprisecraftsmanship.com/posts/unit-testing-depen...

- Unit Testing Principles, Practices, and Patterns




> The author is advocating for mockist style of unit testing

IMO: "mockist" style of unit tests are best for corner cases that can only be tested in isolation. For example, error conditions that are important to verify, but so difficult or impossible to test that the only way to test them is to test a single class in isolation.


Main reason it it tests unrealistically, I think. The other issues (doesnt catch bugs, hard to maintain) tend to flow from that.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: