When testing a software system, it is important not only to test that all expected behaviour is allowed by the system, but also that all unallowed behaviour is blocked by the system. When students test software, they often focus on happy path behaviour, where they only check that all the behaviour that should be allowed by a system is actually allowed. However, this does not guarantee that the system is correct, as there may still be unallowed behaviour that is allowed by the system.
In fact, there are 4 possible combinations of scenarios that should be allowed/disallowed and scenarios that are blocked/not blocked by the system. If either an allowed scenario is blocked by the system or a disallowed scenario is not blocked by the system, then the system is not correctly implementing the requirements. When using positive testing, it is only possible to check whether the allowed scenarios are blocked by the system or not. When negative testing is also used, it is also possible to check whether the forbidden scenarios are either blocked or not.
A practical application
Consider the following software system. According to the requirements, a person can rent tuxedos, but a person cannot start renting tuxedos until they have applied and been approved.
For example, in a positive test, a tester would correctly check that an approved person can actually start renting a tuxedo (as there is a transition started from approved called MERent). Similarly, using positive testing, it would be discovered that it is not possible to disapprove a person who is waiting for approval, as there is no transition labelled disapprove starting from the AwaitingApproval state.
However, if only positive testing were used, it would go undetected that a person can actually start renting a tuxedo while still awaiting approval, whereas negative testing would detect this. Similarly, if negative testing is used, a tester could also judge that it is indeed not possible for a person to rent a tuxedo before that person has applied (the person is thus in the Exists state).
We are planning to make a collection of cases in which the importance of negative testing is highlighted. All these cases will then be added to a repository which may be used as a module for teaching software testing to novices, students, and learners of any kind.