What Type of Unit Test to Consider

Introduction Unit testing is the basic testing type in software development. The purpose is to demonstrate that the unit or module of software perform what is intended to do.
Potential Test Types Below is a list of the possible unit test types and the conditions for considering using them. The list cannot be guaranteed to be complete.

Consideration Description
Is the functionality important? Then you should consider Functional Test, with focus on verifying that all specified functions for the code module works as specified. This typically cover some kind of branch coverage to show that all options in the code module can be reached.
Is it important that the code survive error conditions?
Then you should consider Challenge Testing where the focus is to verify that the code module can survive unexpected execution conditions.

Examples: database is inaccessible, disk not accessible, network not working, CPU is overloaded, etc.

Is it important that the code survive wrong user behaviour?
Then you should consider Negative Testing where focus is on providing wrong input to the code module to verify that it  can survive wrong indata.

Examples: wrong date format, use of comma instead of dot, special or unexpected characters in names, etc. This test type has a lot of similarities with the Challenge Test.

Is it important that code work in different countries? Then you should consider International Testing where focus is on testing features that are different from country to country to demonstrate that the program do function as intenden in all cases.

Examples: Use of different currency symbols, testing various format for ZIP code, telephone number with different numbers of digits and special character (“+”, “*”, “#”), country with or without regions or state, names with special character (ê, è, ä, etc).

Is it important that user can use the program? Then you should consider Usability Testing or GUI testing where the focus is on how the end-user perceives the use of the application – is it intuitive and logical.

Examples: Verify that an end-user finds the the size of the buttons and input field present on the screen comfortable, alignment of all text, tables and content in the tables for good readability., verify that menues are logically organised, that the page does not fluctuate and the alignment remains same after hovering the mouse on the menu or sub-menu, etc.

Is the response time important? Then you should consider Load Testing where the focus is on the how the code module react under various stress conditions.

Examples: Database access is limited, huge data set being transferred to the database/file system/network, race conditions (two or more programs attempt to access the database/file system/network, many modules access e.g. printer devices, etc.

 Is easy maintenance  important Then you should consider Maintainability Testing where focus is on how the code module react during error conditions – does it provide usefull information to the maintenance group regarding the cause of the problem and where the problem is located:

Examples is very much the same as for Challenge Testing and Negative Testing, but here focus is on the response the software module provides to the maintenance person, i.e. does it clearly indicate what the problem is, what causes the problem and where has it happened, e.g. network error codes, file system error codes, database error codes, indata format check information, etc.

Is security important Then you should consider Security Testing where focus is on how the code module is secure from internal and external threats. This testing includes how much software is secure from the malicious program, viruses and how secure and strong the authorization and authentication processes are.It also checks how software behaves for any hackers attack and malicious programs and how software is maintained for data security after such a hacker attack.

Examples:

 Is it important that the system recover gracefully for disasters Then you should consider Recovery Testing where focus is on verifying that the  code module is able to continue the operation after a disaster.

Examples: Assume that application is receiving data through the network cable and suddenly that network cable has been unplugged. Sometime later, plug the network cable; then the system should start receiving data from where it lost the connection due to network cable unplugged, etc.

 Is it important that the code works the same in different environemtn Then you should consider  Compatibility Testing, where focus is on verifying that the code module will work the same way in a different environment, web servers, hardware, and network environment.

Examples: run the code module in different configuration, different database, different browsers and their versions.

more questions to come!