Sign in
Just Coding
.NET developer spanish bits
Options
Blog Home
Email Blog Author
Share this
RSS for posts
Atom
RSS for comments
Search Blogs
Tags
Agile
alm
builds
cod
Code
code tools
DevTools
events
OOPSLA
Pages
pdc
projects
ReleaseManagement
rido
sharepoint
TechEd
testign
testing
Tips
TODO List
tools
tools sharepoint
trx2html
visual studio
Web
Archive
Archives
May 2013
(1)
February 2013
(1)
January 2013
(2)
November 2012
(1)
June 2012
(1)
February 2012
(2)
January 2012
(1)
November 2011
(2)
October 2011
(1)
May 2011
(5)
March 2011
(1)
January 2011
(2)
October 2010
(1)
August 2010
(1)
July 2010
(1)
May 2010
(2)
April 2010
(6)
March 2010
(1)
February 2010
(1)
December 2009
(1)
November 2009
(2)
October 2009
(3)
September 2009
(1)
August 2009
(2)
May 2009
(1)
January 2009
(1)
October 2008
(2)
September 2008
(2)
May 2008
(1)
February 2008
(2)
September 2007
(1)
June 2007
(2)
May 2007
(1)
November 2006
(3)
October 2006
(7)
September 2006
(2)
August 2006
(4)
June 2006
(2)
May 2006
(3)
February 2006
(1)
December 2005
(1)
November 2005
(4)
October 2005
(6)
September 2005
(5)
August 2005
(1)
July 2005
(5)
June 2005
(8)
May 2005
(8)
February 2005
(6)
January 2005
(2)
November 2004
(8)
October 2004
(21)
September 2004
(2)
August 2004
(3)
July 2004
(9)
June 2004
(7)
May 2004
(2)
April 2004
(1)
March 2004
(5)
February 2004
(9)
January 2004
(2)
Unit Test Rules
MSDN Blogs
>
Just Coding
>
Unit Test Rules
Unit Test Rules
Rido
21 Sep 2005 6:05 AM
Comments
1
Michael Feathers has posted a set of Unit Tests Rules
http://www.artima.com/weblogs/viewpost.jsp?thread=126923
he said:
A test is not a unit test if:
It talks to the database
It communicates across the network
It touches the file system
It can't run at the same time as any of your other unit tests
You have to do special things to your environment (such as editing config files) to run it.
I understand his motivations to write this, however I think his position is very aggressive. Frankly, I have learned UnitTests reading tests from other people, and I've always seen some kind of dependencies with the Filesystem and sometimes a Database, and I don't think this makes these tests less Unit.
I would like to reconsider each of first three points:
It talks to the database
.
use different db for unit and integration testing
the database can be created from scratch easily
tests uses the smallest amount of data they could
unit tests always execute though a local db instance
It communicates across the network
I always avoid to depend in another machine, so if you need to use the network always use localhost, and like the db, you must be able to setup the server side easily in your dev/build box.
It touches the file system
I completely disagree this one, it's like if you said "it touches the memory". I don't like to depend on predefined paths and I always try to put my testfiles as resources of my test library, however there are too many situations where using the FS make things easier.
Finally I agree with the last two sentences…
1 Comments
DevTools
,
Agile
,
Code
Comments
Loading...
Leave a Comment
Name
Comment
Please add 7 and 7 and type the answer here:
Post