One of my friends explained how they ping pong mate with TDD in their workplace, and he said that they take a โcompetitiveโ approach. That is, when the user responsible for the test passes the keyboard to the developer, the developer tries to do a simple (and sometimes wrong thing) to pass the test.
For example, if they test the GetName () method, and check the check for "Sally", implementing the GetName method will be simple:
public string GetName(){ return "Sally"; }
That, of course, would pass the test (naively).
He explains that this helps eliminate naive tests that verify specific canned values, rather than testing the actual behavior or expected state of the components. It also helps drive the creation of more tests and, ultimately, better design and fewer errors.
It sounded good, but in a short session with him it seemed like a lot more time had passed to pass one round of tests than otherwise, and I didnโt feel that much extra value was gained.
Do you use this approach, and if so, have you seen its redemption?
source share