Re: establishing logical test order?

"Butler, Tony (London)" <[email protected]>
Newsgroups gmane.comp.windows.dotnet.nunit.user
Message-ID <[email protected]>
On Mon, Jun 23, 2008 at 11:53 AM, Pigneri, Rocco
<[email protected]> wrote:


		As you mentioned, that is not a natural feature of unit
tests: unit tests are by definition unrelated to each other and can be
run in any order without introducing failures. 

	

	Yes, my tests can be run in any order, they are all independent
tests of a single piece of functionality. 
	
	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.
	[Butler, Tony] 
	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.
	 
	This has the added bonus that you can change the implementation
of these dependencies without having to rewrite your code, provided the
interface remains the same.
	 
	 
	cheers,
	 
	Tony
--------------------------------------------------------

This message w/attachments (message) may be privileged, confidential or proprietary, and if you are not an intended recipient, please notify the sender, do not use or share it and delete it. Unless specifically indicated, this message is not an offer to sell or a solicitation of any investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Merrill Lynch. Subject to applicable law, Merrill Lynch may monitor, review and retain e-communications (EC) traveling through its networks/systems. The laws of the country of each sender/recipient may impact the handling of EC, and EC may be archived, supervised and produced in countries other than the country in which you are located. This message cannot be guaranteed to be secure or error-free. This message is subject to terms available at the following link: http://www.ml.com/e-communications_terms/. By messaging with Merrill Lynch you consent to the foregoing.
--------------------------------------------------------

-------------------------------------------------------------------------
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

_______________________________________________
Nunit-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nunit-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.