Schedule and Events



March 26-29, 2012, Software Test Professionals Conference, New Orleans
July, 14-15, 2012 - Test Coach Camp, San Jose, California
July, 16-18, 2012 - Conference for the Association for Software Testing (CAST 2012), San Jose, California
August 2012+ - At Liberty; available. Contact me by email: Matt.Heusser@gmail.com

Thursday, August 07, 2008

The Unit Test Unit

Remember the bru-ha-ha when I asked to define unit test? Well, it's published. :-)

Chris McMahon and I co-wrote "The Unit Test Unit"(*), which updates Meyer's 1979 definition for today and includes some more current terminology; here's a link.

Of course, your comments are welcome. Feel free to use our definitions if you think they are helpful.


--matt
(*) - Yes, my editor picked the title. It grows on you, really.

2 comments:

Shrini Kulkarni said...
This comment has been removed by the author.
Shrini Kulkarni said...

>>>A set of logic, implemented in code, small enough to be testable, generally only visible to programmers and not end users.

Let me strech this a bit and do some hair splitting ...(just to make these definitions more robust)

Matt, It will help you further clarify on ....following terms

"set of logic" - Set of logics? Is logic a sigular noun?

"small enough to be testable"

"testable" - the word testable can have different meaning for programmers, non programmer testers
Imagine a black box tester - someone who typically tests not using the code - saying "This app is hard to test". How this will be different if a developer writing a xUnit Test saying ..."this peice of code is hard to test"...

I suppose that in this context, you are referring to testability from Unit testing perspective ....
If yes... you should include testability also as a term to redifine as part of this article ...

When you say "small enough to be testable" --- you are linking "Programmer Testabiliy (I think that is the better term)" to size of the code ...

Well... that brings the question how do you propose to measure the size of code?

So, for defining what qualifies to be a unit -- the variables are notion of "size of code" and notion of "testability". Let me go further ...I should fix one and vary the other and see if it meets the criteria ...

For examples... Let me pick a peice of code (fix size in terms of say block (?) of code) and then see if it is testable... if yes that is a UNIT. if not reduce the size of the code and check for testability ... iterate till you get size "just right" ....

Conversly it may so happen that your size is tool small to begin with ... so you can keep increasing size untill the code is no longer testable ... that threshold where status of testability check fails -- transition happens from testable to not-testable.

Why do we need to take all this pain ... Do precisely arrive at a notion of a unit so that all related entities can be thought about clearly in terms of this unit ....

Hope this makes senses... I hope I did not go very deep into "hair splitting" ...

Shrini