When testing, I find that it is important to be cognizant of what you’re testing. I’ve seen (and done) tests where I was using my IoC container to inject a dependency. You may think, “That’s the way it will work in the real world.” The problem is, it may have nothing to do with the System Under Test (SUT). So, you’re test might fail because something went wrong with your IoC container or configuration and have nothing to do with your SUT failing at all.

The important thing to remember is test what you are trying to test and nothing more. Remove any other failure points within a test other that the SUT, then you can be sure a failure means a failure with your SUT and not something else.

 

~Lee

posted on Monday, October 13, 2008 1:34 PM | Filed Under [ TDD Dependency Injection ]

Comments

No comments posted yet.
Post Comment
Title *
Name *
Email
Url
Comment *  
Please add 8 and 3 and type the answer here: