I use TDD and mocking/stubbing (conjure) to test each layer of my code.
The problem is when I change the function signature and the tests do not
break, because the mocks/stubs do not know when their argument lists no
longer agree with the underlying function they are mocking.  Is there a
way to catch this?  Short of a test suite that eschews stubbing in favor
of full setup/teardown of DB data for each test?

Could you give an example? I use mocks fairly heavily, and I don't seem to have this problem. Perhaps it's because I change the tests before the code?

That said, I don't mock out our persistent storage tests. That is, we have facade namespaces over Monger (Mongo), Korma (Postgres), and Redis (Carmine). The facades' tests go directly to the database. This is plenty fast enough, and I rarely find writing the setup code much of a burden. Part of the reason is that we explicitly allow "partially constructed data" (as opposed to the OO advice that all constructors should produce objects that satisfy all the invariants). The benefits exceed the dangers, I believe.

Note: this is consistent with the advice of some of the "mockish TDD" old-timers: "only mock objects you own".

A fair number of tests for the code that uses the facades goes to the database too. Whether I use mocks or not is really a matter of my own convenience.

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to