Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
Testing Is Not Technically Hard, It Is Hard Because It Requires Clear Thought and Understanding

This whole "lets make TDD easier for the masses" thing is getting out of hand.

Unit tests are not technically hard, as Udi points out, what is a test? Anything with TestFixture on it?

It is not a technical challenge to write a unit test, any half trained monkey could do it. A few attributes, a couple of classes, a few new() statements, and a few Assert statements. We don't need magic mocking frameworks, we don't need any mocking frameworks for 90% of our tests, we don't need application of 12 GoF principles before we can write a test, honestly.

Testing and writing automated tests is hard because it requires a strong understanding of the user stories that sit behind your code and project, because it requires you to think as a user and not as a developer, and because it requires you to be able to think of multiple conflicting axioms, test cases and class interactions, and how to cover the weaknesses of each individual test with other complementary tests.

Bad tests have no value - none. The only "value" that matters is "business value", and a bad test will not reduce your development time, nor will it reduce your maintenance time ... in fact quite the reverse, bad automated tests will require significant maintenance themselves, will force your code to become rigid and resistant to refactoring to a better code base, and give people relying on your tests as a form of usage doumentation totally the wrong ideas, or worse still confuse the hell out of them.

A project with no automated tests is verifiable by observation and UAT. A project with bad automated tests can still be verified by UAT but will now be complex to refactor or fix when problems or bugs appear. A project with a few key *good* tests around *key* functionality will provide a good balance of verification and sanity checking, and still allow the project to be maintained later.

By all means start writing unit tests, but make them Spikes, and you will soon see how your Spikes project becomes fixed in time, with most of them not working after a few weeks of development - now imagine they were automated tests you were maintaining ... /shudder

I can teach someone every part of SOLID they need to be able to write a technically competent unit test inside a day, teaching them how to write tests that have value takes months or years, there is no substitute for experience - but gaining that experience on your employer's time is only valid when the business says it has value to them, and when they understand it will result in a significantly longer delivery schedule - otherwise pay some good testers to do what testers do very well.

Morning rant over, your normal service can now resume.

 


Posted 10-01-2008 9:46 AM by Jak Charlton
Filed under: ,

[Advertisement]

Comments

ISerializable - Roy Osherove's Blog wrote Unit Testing decoupled from TDD as well== Adoption
on 10-01-2008 9:27 AM

The discussion on the future of unit testing for the masses has shifted from the standard “if they are

Dew Drop – October 1, 2008 | Alvin Ashcraft's Morning Dew wrote Dew Drop – October 1, 2008 | Alvin Ashcraft's Morning Dew
on 10-01-2008 10:27 AM

Pingback from  Dew Drop – October 1, 2008 | Alvin Ashcraft's Morning Dew

2008 October 02 - Links for today « My (almost) Daily Links wrote 2008 October 02 - Links for today « My (almost) Daily Links
on 10-02-2008 3:59 AM

Pingback from  2008 October 02 - Links for today « My (almost) Daily Links

Kevin Berridge wrote re: Testing Is Not Technically Hard, It Is Hard Because It Requires Clear Thought and Understanding
on 10-02-2008 1:26 PM

Hear hear!

Integration testing in maven - With Maven, Cargo, httpunit and Selenium — andrewmccall.com wrote Integration testing in maven - With Maven, Cargo, httpunit and Selenium — andrewmccall.com
on 10-14-2008 8:27 AM

Pingback from  Integration testing in maven - With Maven, Cargo, httpunit and Selenium — andrewmccall.com

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Subscribe
Google Reader or Homepage

del.icio.us CodeBetter.com Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl CodeBetter.com Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of Devlicio.us
Red-Gate Tools For SQL and .NET

NDepend

SlickEdit
 
SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
LiteAccounting.Com
DevExpress
Fixx
NHibernate Profiler
Unfuddle
Balsamiq Mockups
Scrumy
JetBrains - ReSharper
Umbraco
NServiceBus
RavenDb
Web Sequence Diagrams
Ducksboard<-- NEW Friend!

 



Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers

 

Community Server (Commercial Edition)