A unit-test function correspoding to each unit-test case broadly consists of the following sections.
1) Precondition Tweaking (Prologue)
Prepare the conditions necessary for the function to execute. Do this for all preconditions not mandated by the test-case; not supplying precondition(s) to see if the function fails may be the test-case.
2) Invocation (Test)
Call the function.
3) Post-condition Verification (Epilogue)
Check whether all the post-conditions have been enforced by the function. Check whether the result tallies with the expected result of the unit-test case.
4) Logging
This may be part of the unit-testing framework itself, if you are using one.
Link the test-function with the test-harness and the unit to be tested. Call these test-functions from a driver program to see how your unit copes!
Sunday, August 19, 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment