Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

22
  • 7
    Read agitar.com/downloads/TheWayOfTestivus.pdf, especially page 6 "The test is more important than the unit". Commented Nov 2, 2015 at 21:20
  • 3
    @Ben mocked integration tests test production setup even less... Commented Nov 2, 2015 at 21:51
  • 7
    How would your coworker be absolutely certain that his mocked database behaves as the real thing? Commented Nov 2, 2015 at 22:11
  • 14
    You are trying to be realistic. Your coworker is trying to adhere to rules. Always write tests that produce value. Don't waste time writing tests that will be unmaintable, and don't write tests that don't do one of the following: increase the probability your code is correct or force you to write more maintainable code. Commented Nov 2, 2015 at 23:26
  • 4
    @mindplay.dk: the key sentence in that paragraph is "But don’t get stuck on any dogma. Write the test that needs to be written.” Your co-worker seems be stuck in a dogma. And you do not need someone explaining you what the test is that needs to be written in your example - you already know that. It is pretty obvious that for testing if your database understands the query, you have to run the query against the real database - no mock can tell you this. Commented Nov 3, 2015 at 4:51