Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Mocks are the personification of bad data. The only meaningful measurement derived from tests with mocks is how bad the architecture is.


I don't know what you're criticizing here. I was contrasting "mocks" and "fixtures" in the context of unit tests as ways to instrument services depended on by the code under test.

A "mock" in this paradigm is some kind of testing technology that allows you to directly instrument return values for function calls on the dependent service, whereas a "fixture" is some concrete test-only thing you coded up to use in your tests.

If a fixture just acts as a dummy return-value provider, no problem (but you probably should have used a mocking solution). The problem that arises is fixture code that simulates some or all of the production service code, and/or (even worse) allowing modification of production code to allow use as a test fixture. This is the way to madness.




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

Search: