Writing your own Test unit is very important, not just to test your code but also to give you an eagle's-eye view on how your code is actually interacting with the system. It gives your coding a meaning, and allows others to understand and relate to your development. Writing a unit test involves basically four steps as shown in the following diagram:
We first set up our data, or create the records that we will be testing later, using some statements. A statement might be an error message, value checking, confirmation, and others. After we get the statement in exercise, we verify our result with the result that is intended from our code that is being tested. If the verification is complete, then we tear down the setup data, and present the success and failure result so as to document the test.
For the sake of writing a simple unit test, let us take an example of a simple error message. While creating a new item, if you choose the item tracking code whose SNSpecific...