Unit Tests as documentation


Since Unit Testing is becomming a defacto used practice in modern programming, this is an interesting topic to say the least:

The next XP BE meeting will be hosted by Philippe De Bruycker of the
Federal Administration of Foreign Affairs in Brussels.

The topic of the evening will be “Unit Tests as documentation”. If you
have something to tell about the subject, let us know. Even better, if
you have some unit tested code, why not bring it along so that we can
see if the tests (help) document your code?

More info and registration at
http://wiki.xp.be/scripts/view/Xpbe/XpBeMeeting21122004

Because you need a badge to get in (and out), register at least a week
before the meeting. Put your first+last name and car registration number
  on the list on the wiki.

Comments (4)

  1. I talk about using Unit Tests as documentation (and even generating documentation from Unit Tests) in my presentation "The Value of Agile Methods".

    http://blogs.conchango.com/howardvanrooijen/archive/2004/12/07/397.aspx#AgileSpec

  2. Sam says:

    Yep, Unit Tests are a good way to show how a library should be used.

    They are some kind of sample cases. What makes them different is that you keep Unit Tests up to date (to pass the tests), sample cases usually decay over (short) time.

    Sam

  3. Sam,

    One of the things I usually do is bake the code from the Unit Tests into the XML Documentation <Examle><Code> for the class being tested – then at least when you gen your documentation the user has a clue about how to use your API.

    /Howard

  4. dhana says:

    hai friends,

    if any one have sample Unit testing document . tell me . my mail ID: dhana_java@yahoo.com.

    thaks

    by

    dhana