Tuesday, June 20, 2006

Unit Testing is Hard

Private methods:

I don't know if there is good way to test your private methods. I had to make them public so the test class could access the private method. This makes for very intrusive unit testing. I had to change my model so that I could unit test .. That's not good.




Methods with object arguments (non primitive arguments)::


You have to create these objects so that you can pass them to the mehtod. What if these classes do not have empty constructors. Creating dummy objects that you can pass to your methods is a pain. This is why having interfaces makes testing easy. I programmed with Mock Objects and that was a little better. Still, there has got to be a better way to create mocks very quickly with minimal effort on the programmer.