Our life revolves around software’s. From hospital’s ICUs to the billing desk at shops and from the airplane’s cockpit to computer desks of academicians and scientists they are everywhere. Such is their impact that they have rapidly made the transition from being supplementary to being essential. Owing to their pervasive, it is easy to imagine what kind of effect a software failure can have on our lives. If you find the argument an exaggeration, then try to imagine a situation when your browser keeps crashing!
The Importance of a stable software cannot be understated. It is definitely important to have a correct software solutions, wherein a correct answer is provided for a valid input. However, a software must also be stable, robust and reliable because we as humans are prone to errors.
Consider you are shopping at an e-commerce site. You decide to buy 2 handbags and 1 mobile and consequently add them to your cart. However, a few minutes later you decide against buying any handbags at all and again visit the cart to decrease the quantity of bags. In your haste to get through with the payment you erroneously decrease the quantity thrice and then proceed. The system accepts ‘-1’ as an input and charges you for the same. Imagine the horror when you learn that you had been charged for a product which won’t be delivered. The tester could have tested that the systems respond accurately for various different positive quantities, however, if he fails to test for “negative paths” then such a scenario can happen.
The above example is very simplistic in nature, yet underlines why negative testing is required. These are some small bugs which, if saved can save the company from many blushes. Negative testing essentially involves checking system behaviors for “negative paths”. Negative paths are those paths which a user is not supposed to tread. A very simple example could make matters clear- suppose if a system asks for user details. In the email-id section, the format accepted is clearly mentioned. The system expects the input to have ‘@’ character. Even with the guidelines laid down, the tester still needs to ensure that system doesn’t accept invalid input, which in our case could be an input devoid of ‘@’ character. He needs to ensure that if such a scenario takes place, the system should exit gracefully instead of crashing or accepting input. Hence we can say that Negative Testing involves testing for inputs which are opposite to the requirements mentioned.
Testing for negative test cases ensures that the integrity of the system remains intact. Secondly, from a psychological point of view, when a program crashes unceremoniously for a small mistake committed by the user, it leaves him frustrated. The system makes his small mistake appear bigger by blowing things out of proportion. Thirdly, it decreases the performance and efficiency. If the program crashes frequently, then setting it up again and again becomes a tedious task. Furthermore, it may also lead to loss of database integrity with the data becoming corrupted.
Though negative testing is extremely important, it is often neglected. This happens due to 2 reasons- lack of skills and cost optimization. As far as skills are concerned, Negative Testing depends heavily on the ability of a person to imagine. It requires thinking from the perspective of a user and then imagining the kind of errors he/she might do. The person, not only needs to understand the objective and working of the software, but should also know ‘how’ and ‘where’ the system would be deployed. The latter reason is more of a trade-off between quality and cost.
Any kind of testing ensures the quality of the product is up-to-date. Positive testing ensures correctness of the program while Negative Testing does the important task of ensuring robustness and reliability of the software. While positive testing saves the company from criticism, it is Negative Testing which helps the company to get accolades for their performance. Negative Testing is in the true sense of meaning- Quality Assurance!