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.

One comment on “The Unit Test Unit

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

Leave a Reply

Your email address will not be published. Required fields are marked *