Re: establishing logical test order?
"David Jeske" <[email protected]>
| Newsgroups | gmane.comp.windows.dotnet.nunit.user |
|---|---|
| Message-ID | <[email protected]> |
David wrote: > However, all tests depend on the proper functioning of "upstream code". I > like to see the failures in order from smallest to largest number of > dependencies, because that's where the core problem usually lies. For > example, if something broke the core .NET string class, wading through all > kinds of other tests is not necessary if your basic-core set of tests right > at the top said strings are somehow broken. > Tony wrote: > This is a very good example of why dependency injection is so useful. When > you are testing your code, it should be just that - YOUR code you are > testing, not any external dependencies. If you are using dependency > injection then for your unit tests, you could mock these dependencies (your > "upstream code") and, regardless of whether they are broken or not, you will > know that YOUR code which you are currently testing, works fine. > Are you implying that you mock our EVERY object outside the object-in-test? so it is always only YOUR code you are testing? DI is a good tool, but it is not the right tool for every dependency in every situation. ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php