I am not sure I understand your question. I typically name a test method so that it becomes obvious which scenario I am testing, such as testSquareOfTwo or testThrowsExceptionForNegativeValue. Besides that, the tests are typically so easy to read, that they don't need more documentation. Can you give us an example of a test you want to document further?
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Pradeep, There are some common conventions that help with this. Unit test classes are named with the name of the class + the word test. So HelloTest.java would be tests for the Hello class. This documents which class the tests pertain to. Unit test methods are usually named with test + the name of the method + any extra information. Some people append underscores between the parts. So testMethodForNull would test the method "Method" for the condition where null is passed in.
This may be way off-topic for you. But, you could also manage traceability relationships in some requirements management tool like RequisitePro. That way, you could tell exactly what unit tests are associated with the methods in your components, etc. It sounds like you are looking for something that is more coupled to your source code though.
Thanks for your replies. My manager want to me to list the unit test cases in a document with a brief description. Is this the process normally followed? :roll: I thought we just code the unit test case in the class. Simply, I want to know if documentaion is required, can't I directly code the test case.
Originally posted by Pradeep Bhat: My manager want to me to list the unit test cases in a document with a brief description. Is this the process normally followed? :roll:
It sounds like your boss wants to check a checkbox in his deliverable list... Just try to be as brief as you can -- it's probably of no use to try getting him to forget the document completely (assuming that your process requires such a document among the deliverables).
Run JavaDoc on your test classes, if you have any sort of method description there. If you're slick, then you can apply a transform on the documentation to get a document in exactly the format your boss wants. If you're like me, and not slick, at least you've got an easy set to copy/paste from.