Geeks With Blogs
Lee Brandt's Blog You're only as smart as your last line of code

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 TDD , Dependency Injection | Back to top


Comments on this post: Be Careful What You Inject

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Lee Brandt | Powered by: GeeksWithBlogs.net