I am looking for feedback from the group. I am pretty new to using
mocks for my unit tests and I am not sure what the standard approach in the
community for usage of mocks in regards to how/where they are stored in your
After refactoring some of my tests to use mocks I quickly noticed that I was
littering the same mock creation code in many of the unit tests. So, the
first thing I did was create a local helper method inside my test. However, as
I continued my refactoring I was started to create the same helper method in
many classes. After noticing what I was doing, I knew there had to be a
better way to do this.
What I am thinking of doing is creating a ‘Mocks project’ that will only
contain static methods that can be called (with and without construction params)
to build and return a mock for a given interface. The reason I want separate class for this is
because 2 different projects use the same backend, but each have their own test
Does this sound absurd?
Thanks for any insight.
04-17-2007 7:35 AM