Mocking Done Badly

Published

May 11, 2010

using(Playback) {
   sut.PerformAction(parameter);
}
This is the last part of a common style of mock test. We see the system-under-test (sut) being asked to perform some action, and some parameter is passed to it.  We know it’s a mock test because of the Playback bit. 
What is being tested here? Well something about PerformAction is being tested. Not much there. No clear assert written at the bottom of the test to capture our attention.
Let me narrate as I work through the actual code before me, and maybe the readers can respond to tell me whether this really is mocking done badly, or I’m “just not used to good mocking.”

I struggle not to look at the test name, so the code can speak to me more directly.
At this point I’ve read the whole test. Hmmm… what are we doing here again?

I do have to wonder if they have any real value other than cementing the code’s current implementation into the test suite.  If we extract a method or inline a method, I know that these tests will fail. The new method will not be “incorrect”, only “different.”  It bothers me that the tests will fail if I improve the structure of the SUT.
This is doing test-last, which is a poor way to do testing.  That means it’s most likely a poor way to do mocking. The tests are fast and decoupled from database, etc.  
It takes much longer to write about this than to do it, yet I took the time so that there is some basis for discussion. Is my code conscience overly-sensitive, or does this have several kinds of wrong in it?
Is this mocking done well, or done poorly? You tell me.

* the last desperate measure is to trace execution with the debugger.