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

> I dislike mocks. I've never seen the point in testing code against an entirely fictional representation of the most complicated and slow part of the system, just because it happens to be more convenient.

You aren't testing code against an entirely fictional representation of the system, you are testing one piece of code in isolation, and using a fictional representation of another piece of the system to eliminate variables.

Unit testing is about verifying that individual components do their job correctly -- when doing it, you literally don't care what other pieces of code would do, because that's out of scope of the unit test.

Testing that the whole system works together is system/integration testing, and is a different thing. You don't use mocks for system testing, only unit testing.

> If an app is worth writing, and worth writing tests for, do it justice and test the whole shooting match.

Yes, that's what system/integration testing is for.

That doesn't mean you shouldn't have code that is amenable to proper unit testing.




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

Search: