Write a test that invokes a procedure in question and compares its result or side effects with an expected result that is embedded in the test procedure.
Determine whether a specific procedure is functioning as you expect it should.
What inputs does a procedure accept?
What results does a procedure compute?
What side effects does a procedure cause?
What exceptions does a procedure activate?
What outputs does a procedure display?
Complex procedures may require many unit tests to test thoroughly. Knowing when you have a complete set can be difficult.
Copy code you have inserted into the procedure as debugging infrastructure into unit tests.
Copy code you executed in a debugger to exercise the procedure into unit tests.
Use a unit testing framework such as JUnit. Unit testing frameworks for many other programming languages are also available. See our Website for further information.