Sign in
|
Join
ISerializable - Roy Osherove's Blog
Unit Testing, Agile Development, Leadership & .NET - By Roy Osherove
This Blog
Home
About
Syndication
RSS
Atom
Comments RSS
Search
Go
Navigation
Home
Blogs
News
My new book is out!
The Art Of Unit Testing
Buy and read it as I write it.
I work at:
Your ad here
The Art Of Unit Testing Book
Roy's Cool Tools
Subscribe!
Subscribe to ISerializable by Email
About
Hire me
Ask me
On my bookshelf
About me
Ego trip
Roy's Tools
5 Whys - a blog for team leaders
Key.bo - a search engine wiki for keyboard shortcuts
unit testing
ruby styff
All Developer Songs
It's Time for Violence
Que Sera Sera
Articles
3: Oops! Typed Datasets
Are
scalable!
4: Introduction To Regular Expressions
5: Practical Parsing Using Groups in Regular Expressions
6: UI Threading Helper Classes
Make Your App Support Plugins 2 - Dynamic Search (MSDN)
Winforms Data Binding Lessons Learned
Make Your App Support Plugins (MSDN)
1: Introduction to Typed Datasets
2: Typed Datasets Are No Silver Bullet
My articles on MSDNAA
7: Solving VS.NET Debugger Problems
Make your log files searchable using Regex and the XML classes (MSDN)
Introduction to TDD with NUnit
Fun with Unit Tests – Testing abstract classes
New: Creating a generic Site-To-RSS tool
.Net scripting
- the practical way
Simplified Database Unit testing using Enterprise Services
Creating custom test attributes easily with NUnit 2.2.1
Cool tools every .Net Dev should be aware of
Cool Tools every .Net developer should be aware of
New: The case for staged delivery and Agile methodologies
My .Net Deep Dive lectures on video
New: Defensive event publishing in .Net, part 1
Test Feasibility Matrix
Depenedency Breaking Issues
*new* Achieving And Recognizing Testable Software Designs – Part I
Favorite Blogs
The Morning Brew
Martin Fowler
Scott Hanselman
Joel On Software
.NET Weblogs
Microsoft Israel Community
The Runtime
Daniel Moth
Oren Eini
Jimmy Bogard
CodeBetter
Dustin Campbell
Guy Kawasaki
Stephen Toub
Research @ Intel
Udi Dahan
The Typemock Insider
My Projects
Vs.Net Settings import.export Add-in
SchemaHelper - auto-detect & create data relations
Proxy handling using ProxyFactory and ProxyInfo
BackgroundWorker implementation
XtUnit: An Unofficial Unit Testing Extensibility Framework - Add new attributes to NUnit or MbUnit e
Intercetpion Application Block
Extensibility Application Block
The Regulator
VS.Net 2003 registry tweaker
My Tools page
Regular Expressions
RegEx Lib
Expresso
Regex Blogs
Sites : .Net
.Net Tools List
.NetWebLogs Forums
Winforms FAQ
.Net Debugging Resources
.Net WebCasts & Others
.NetWeblogs Archive
MSDN Magazine
Design Patterns in C#
.Net Rocks Radio
.Net Resources
Howto: .Net common tasks
VB.Net blogs on MSDN
.NetSlackers
Sites : Misc
Regular Expression Library
MSR Downloads
Win2k3 Tweak Guide
About Microsoft Interviews
Tech Interview Riddles
Feedster
Amazon Light
C:\Utils
Sites : Unit Testing & XP
NUnitASP
Tips and techniques with NUnit
NUnit
NUnit Addin
XProgramming
MSDN Mag:Simplify Data Layer Unit Testing using Enterprise Services
Tags
.NET
.Net 2.0
.Net Original
.Net Quotations
.NetWeblogs Site
Addin Contest
ADO.Net
Agile
Agile Israel News
Agile Related
altnet
altnetconf
altnetisrael
Architecture
Art Of Unit Testing
ASP.NET
BDD
Blogging
C#
CLR
Community
Community News
Cool Articles
Cool sites
Cool Tools
Extensibility
Family
FeatureFocus
Free book chapters
General Software Development
Interview
Lean
Mobile
MSBuild
NDC09-Video
Off Topic
Open Source
Other
Product Reviews
Project Management
racer
Recommended books
Reflection
Regex
Regular Expressions
review
Security
Sharepoint
Silverlight
SOA
Songs
SQL Server
tdd
Team Agile News
Team System
TechEd 05
Testing Guidelines
TestReview
Threading
Tips & Tricks
Typed Datasets
Typemock
Unit Testing
Visual Studio
web
web services
WebCast
Windows Forms
WinFX
Recent Posts
How to: Move your blog off of weblogs.asp.net (aka ‘This Blog has moved’)
test – ignore
Bounty: 500$ is you can convert my blog to squarespace
Join me for a live webinar on unit testing with Isolator++ this thursday
What’s coming in Test Lint 1.5
Archives
November 2010 (2)
October 2010 (4)
September 2010 (4)
August 2010 (3)
July 2010 (2)
June 2010 (5)
May 2010 (6)
April 2010 (6)
March 2010 (4)
February 2010 (5)
January 2010 (11)
December 2009 (7)
November 2009 (7)
October 2009 (5)
September 2009 (6)
August 2009 (21)
July 2009 (7)
June 2009 (11)
May 2009 (13)
April 2009 (5)
March 2009 (21)
February 2009 (4)
January 2009 (2)
December 2008 (5)
November 2008 (6)
October 2008 (13)
September 2008 (4)
August 2008 (13)
July 2008 (19)
June 2008 (5)
May 2008 (17)
April 2008 (11)
March 2008 (13)
February 2008 (16)
January 2008 (21)
December 2007 (8)
November 2007 (18)
October 2007 (17)
September 2007 (15)
August 2007 (19)
July 2007 (18)
June 2007 (33)
May 2007 (16)
April 2007 (10)
March 2007 (15)
February 2007 (10)
January 2007 (11)
December 2006 (22)
November 2006 (18)
October 2006 (19)
September 2006 (30)
August 2006 (19)
July 2006 (27)
June 2006 (26)
May 2006 (32)
April 2006 (15)
March 2006 (20)
February 2006 (33)
January 2006 (23)
December 2005 (22)
November 2005 (41)
October 2005 (21)
September 2005 (7)
August 2005 (28)
July 2005 (41)
June 2005 (60)
May 2005 (14)
April 2005 (51)
March 2005 (31)
February 2005 (17)
January 2005 (63)
December 2004 (45)
November 2004 (35)
October 2004 (28)
September 2004 (36)
August 2004 (21)
July 2004 (44)
June 2004 (63)
May 2004 (62)
April 2004 (78)
March 2004 (64)
February 2004 (55)
January 2004 (67)
December 2003 (34)
November 2003 (67)
October 2003 (68)
September 2003 (113)
August 2003 (56)
July 2003 (112)
June 2003 (71)
May 2003 (136)
April 2003 (52)
March 2003 (81)
February 2003 (77)
Introduction to Test-driven development with NUnit and the NUnit-Add-in
My blog has moved.
You can view this post at the following address:
http://www.osherove.com/blog/2003/9/21/introduction-to-test-driven-development-with-nunit-and-the-n.html
Published
Sunday, September 21, 2003 5:08 PM by
RoyOsherove
Filed under:
Unit Testing
Comments
Sunday, September 21, 2003 2:35 PM by
TrackBack
#
[Article] Introduction to Test-driven development with NUnit and the NUnit-Add-in
Sunday, September 21, 2003 5:21 PM by
Peter Provost
#
re: Introduction to Test-driven development with NUnit and the NUnit-Add-in
Nice article Roy. You really covered this in a nice introductory way. I especially like how you didn't start with NUnit, but showed how to do it without a harness. Nice.
One thing that you missed is the refactoring phase that really should happen after getting a test to go green. That is the point at which you can feel safe about aggressively refactoring because you have tests to prevent you from messing anything up.
Looking ahead, I'm interested in how you intend to address "Testing abstract classes". From a pure TDD standpoint, you don't test abstract classes directly. Abstract classes come into existence due to a refactoring phase. Typically when you find some duplication between two classes that you wish to refactor out, introducing a common base (abstract) class is one choice.
If your tests of the concrete classes were complete enough, then you will get coverage of the base class for free.
Nice work,
Peter
Sunday, September 21, 2003 5:35 PM by
Roy Osherove
#
re: Introduction to Test-driven development with NUnit and the NUnit-Add-in
Peter. Thanks for reading. I didn't show refactoring explicitly because refactoring is a process which has its place in more complex examples. I do intened to show the benefits of TDD and how refactoring fits into this nicely in the next article.
As for testing the abstract classes, it really depened on the situation. Sometimes abstract classes are introduced early in the design phase and not after refactoring. This comes into play mostly when you design and implement frameworks for others to build on. That article will show, among other things, how using Mock objects, derived from the abstract class can help test inner workings and assumptions, but I don't want to give it all away now, do I? :)
Monday, September 22, 2003 5:00 AM by
Lorenzo Barbieri
#
re: Introduction to Test-driven development with NUnit and the NUnit-Add-in
Great article Roy! I'm starting to use NUnit and TDD and I've found a lot of interesting starting points. I'll wait the others!!!
Thursday, September 25, 2003 11:26 AM by
Peter Provost
#
re: Introduction to Test-driven development with NUnit and the NUnit-Add-in
RE: Refactoring
I guess my point was that if you do TDD without refactoring, you are only doing half of the process. Sure, refactoring is a large concept but the 5th step of TDD is "Remove Duplication"... i.e. Refactoring. If you only do the first two, you will leave duplication all over the place.
RE: Abstract Classes and Mocks
Sure, I suppose that you need to introduce mocks if it is your expressed purpose to expose abstract classes in a framework for other developers. But if you have implemented a basic concrete class that extends the abstract class, then thorough testing of the concrete class should equal thorough testing of the abstract class.
Also, a number of authors have been noting on the TDD Mailing List lately, that in general the use of mocks should be considered a code smell. If you HAVE to use mocks, perhaps the code isn't clear enough. I'm not sure how I stand on that particular issue, but it certainly makes you think.
Again... excellent work.
Thanks.
Sunday, October 05, 2003 5:50 AM by
Manfred Lange
#
re: Introduction to Test-driven development with NUnit and the NUnit-Add-in
While in general I liked the article, there are a few things I believe need clarification: you listed csUnit as a commercial tool. This is not correct. csUnit (
http://www.csunit.org
) is an open-source unit testing framework for the .NET framework. It is available for free under the terms of the GPL.
Also, csUnit does not provide a different mean of expressing tests, but instead supports the identical set of attributes for writing tests. Furthermore, csUnit introduced the TestFixtureSetup/TestFixtureTearDown methods back in May 2003 while other frameworks supported them not before end of September.
In csUnit, using assertions requires less typing compared to other frameworks, especially if you editor supports autocompletion of code. Just have a look at the csUnit.Assert class.
Support for loading multiple assemblies was introduced in May 2003, too, while other open source testing framework released similar functionality in September 2003.
Best regards,
Manfred.
---
Manfred Lange, Project Manager csUnit
Sunday, October 05, 2003 6:19 AM by
Roy Osherove
#
re: Introduction to Test-driven development with NUnit and the NUnit-Add-in
Thanks Manfred.
I definitely did not know all those things.
Thanks for the clerification :)
Friday, October 31, 2003 9:05 AM by
SBC
#
re: Introduction to Test-driven development with NUnit and the NUnit-Add-in
Good article Roy... thanks..
Friday, October 31, 2003 6:04 PM by
SBC
#
re: Introduction to Test-driven development with NUnit and the NUnit-Add-in
Not too sure about the timing of the 'Refactoring' - I would think it would be post-initial development (at least, not before the alpha stages). Otherwise, coding may be too constrained. I recall peer-coding reviews where the compiler warning switches were set very high (level-5 in the old MFC/VC++) but this was 'automated' and 'refactoring' can still be a bit subjective...
Tuesday, November 25, 2003 4:50 AM by Raj
#
re: Introduction to Test-driven development with NUnit and the NUnit-Add-in
can I have all the methods in one file so that its easy to understand and use it as a reference while coding.
thank you
Tuesday, November 25, 2003 7:50 AM by
Roy Osherove
#
re: Introduction to Test-driven development with NUnit and the NUnit-Add-in
Raj - I'm not sure what you mean.
Sunday, March 21, 2004 4:35 PM by
TrackBack
#
Test Driven Development with NUnit
After having it appear again on my "technology radar" this weekend, I've finally decided to give Test Driven Development (TDD) a try with NUnit. I'm using my SharePointFav application as the guinea pig. So far, I'm finding it quite helpful....
Wednesday, May 19, 2004 4:32 PM by Lax
#
re: Introduction to Test-driven development with NUnit and the NUnit-Add-in
Hi ,
Im trying to use "TestFixtureSetUp" in my project and I'm getting this compilation error.
The type or namespace name 'TestFixtureTearDown' could not be found (are you missing a using directive or an assembly reference?)
I've included the NUnit.Framework.dll in my Reference list.
I also have "using NUnit.Framework" in my code.
I've installed the NUnit add-in for VS .NET 2003. created this project as "NUnit test" project.