Unit Testing Checklist
Unit testing is simply running a piece of code or functionality by developers until they reach a point where a set of methods are executed on a frequent basis. Once a set of unit tests are over and developers are sure that the code has no fault in it, then units are further sent to the next phase in SDLC.
Unit Testing Checklist
For instance we are testing a web application, following are the various dimensions from which it needs to be tested, each component being a single 'unit' or 'entity'.
- The homepage should appear on the very first call to a webpage.
- Notify the user if he tries to login with only user id or only password.
- Error notification on an incorrect input of user id and password.
- Text fields and buttons must be aligned properly.
- Every text field must adhere to field validation constraints, that is, restricting blank spaces in an email and password fields, restricting to the character limit in a field etc.
- A use must be able to login to a single browser on a machine at a given point of time.
- A user must be notified if he fails to fill any mandatory field on the form.
- Each field is restricted by a certain length of characters, hence a user must get appropriate notification if there’s some fault in doing that.
- Format specifications for fields like phone number, email id, password etc. must be tested.
- Check if the ‘Tab’ order is working fine.
- List boxes must display names in alphabetical order.
- ‘To date’ must always be lesser than ‘Start Date’.
- A form must display text fields in an order.
- Enter button on the keyboard must work for ‘Submit’.
- Pin code field must allow only numeric values.
- Test whether the first page appears by default.
- Links for ‘previous’ and ‘next’ pages works fine.
- Pages must navigate according to a certain sequence.
- The current page link must be highlighted.
- Test whether the global search button works for searching any content in the page.
- Check for search optimisation, that is, multiple keyword searching.
- Verify whether the search could be performed on pressing the ‘Enter’ button on keyboard.
- Session Tracking:
- If a user session expires, login to account must redirect the user to the same page.
- After a user hits Logout after which he tries to access that old page, he must be notified to login again.
Access Privileges: Access privileges are validated against authorised users by trying to invade the system by providing incorrect credentials. The system must not allow a user to enter the system if it doesn’t find an appropriate match between its database and the input received from a user.
- The CSS styles must work as per its design specifications.
- Fonts and background colours must be soothing to the user’s eyes.
- Scrolling and navigation from one menu item to another must work seamlessly.
- Networking includes connecting to the server in least time.
- Responding to a request in short cycles.
- Completing transactions by connecting to the bank servers through payment gateway and so on.
- The foremost aspect for checking performance is to test whether query optimisation is applied to a web application.
- Objects within a program must be removed once the task is over.
- Memory leaks should be avoided to the maximum.
A unit test is thus a way to check each functionality in isolation to see whether it delivers the desired output before proceeding further for integration testing.