Twelve Test Pains

“I change one thing in the code and twenty tests break.”

“The API for the unit doesn’t let me set up the situation I want to test.”

“It’s too much work to call this method / instantiate this class/module.”

“I can’t check that this did what it was supposed to do.”

“My code uses framework X, which is not written to be testable.”

“I wish I could test this private method.”

“In order to instantiate this I need to instantiate six other things first.”

“I can’t run this test by itself, I have to run it with these other tests.”

“I wish I my test could see this local variable.” (“Maybe I’ll just return it.”)

“The test suite for this class is 5000 lines long.”

“Adding a new test to this suite requires me to track back through multiple setup functions and helpers.”

“I want to mock this thing returned by this other thing.”