2. What is Unit Testing? Unit testing is a software development process in which the smallest testable parts of an application, called units, are individually and independently scrutinized for proper operation. Unit testing is often automated but it can also be done manually. This testing mode is a component of Extreme Programming (XP), a pragmatic method of software development that takes a meticulous approach to building a product by means of continual testing and revision. Unit testing involves only those characteristics that are vital to the performance of the unit under test. This encourages developers to modify the source code without immediate concerns about how such changes might affect the functioning of other units or the program as a whole
3. Advantages of Unit Test Problems are found early in the development cycle. Code that works now, will work in the future. New features will not break existing functionality. Making change becomes easier, as controls are in place. The development process becomes more flexible. Implementation design is improved as APIs are forced to be more flexible and unit-testable. Bringing new developers on board becomes easier and improves teamwork. Unit tests document the code. The need for manual testing is reduced. The development process becomes more predictable and repeatable.
4. What should be tested when Unit Testing? For a UI screen include test cases to verify all the screen elements that need to appear on the screens For a UI screen include Test cases to verify the spelling/font/size of all the “labels” or text that appears on the screen Create Test Cases such that every line of code in the unit is tested at least once in a test cycle Create Test Cases such that every condition in case of “conditional statements” is tested once Create Test Cases to test the minimum/maximum range of data that can be entered. For example what is the maximum “amount” that can be entered or the max length of string that can be entered or passed in as a parameter Create Test Cases to verify how various errors are handled Create Test Cases to verify if all the validations are being performed
5. Most Frequently Found Issues Spelling mistakes Misinterpretation of requirements Validations not handled like empty string, DbNull checks, time zone issues etc Connection string passed is incorrect Data Source name used is not uniform Validation and Warning messages not generic enough Improper Error handling Dependent codes not analyzed clearly[CR of one conflicting with functionality of other] Design Issues Customization changes not conveyed Values are hardcoded for configurable items(like messages, datasourcename) Filtered views were not getting used at all places Continuous changes in requirement were not kept track off