Loading

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'.

  • Login:
    1. The homepage should appear on the very first call to a webpage.
    2. Notify the user if he tries to login with only user id or only password.
    3. Error notification on an incorrect input of user id and password.
    4. Text fields and buttons must be aligned properly.
    5. 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.
    6. A use must be able to login to a single browser on a machine at a given point of time.
  • Forms:
    1. JavaScript/VB script is there to capture user information on a registration form.
    2. A user must be notified if he fails to fill any mandatory field on the form.
    3. 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.
    4. Format specifications for fields like phone number, email id, password etc. must be tested.
    5. Check if the ‘Tab’ order is working fine.
    6. List boxes must display names in alphabetical order.
    7. ‘To date’ must always be lesser than ‘Start Date’.
    8. A form must display text fields in an order.
    9. Enter button on the keyboard must work for ‘Submit’.
    10. Pin code field must allow only numeric values.
  • Pagination:
    1. Test whether the first page appears by default.
    2. Links for ‘previous’ and ‘next’ pages works fine.
    3. Pages must navigate according to a certain sequence.
    4. The current page link must be highlighted.
  • Search:
    1. Test whether the global search button works for searching any content in the page.
    2. Check for search optimisation, that is, multiple keyword searching.
    3. Verify whether the search could be performed on pressing the ‘Enter’ button on keyboard.
  • Session Tracking:
    1. If a user session expires, login to account must redirect the user to the same page.
    2. After a user hits Logout after which he tries to access that old page, he must be notified to login again.
  • UI Functionality:
    1. The CSS styles must work as per its design specifications.
    2. Fonts and background colours must be soothing to the user’s eyes.
    3. Scrolling and navigation from one menu item to another must work seamlessly.
  • 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.
  • Networking:
    1. Networking includes connecting to the server in least time.
    2. Responding to a request in short cycles.
    3. Completing transactions by connecting to the bank servers through payment gateway and so on.
  • Performance:
    1. The foremost aspect for checking performance is to test whether query optimisation is applied to a web application.
    2. Objects within a program must be removed once the task is over.
    3. Memory leaks should be avoided to the maximum.
  • Conclusion:

    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.