Negative testing is also called as the failure testing or Destructive testing which is used to validate the application whether it is working properly when provided with the negative or invalid data as input.
The main objective of the negative testing is to break the application by giving the negative inputs and validate the response given by the application on providing with the negative or unintentional inputs.
Consider the example of negative testing:
The above diagram shows how the negative testing can be performed. The user is provided the text box in which the user is allowed to enter only the Characters. If the user enters the invalid input as integers as shown in the diagram then it will provide the message as please enter the characters.
While performing the negative testing the followings things need to be considered:
- The data which is provided to be input.
- Action which needs to be performed.
- Output result.
This negative testing tells that what the application should not do.
The following are the characteristics of the negative testing:
- This kind of testing is used to spot the faults which can result into the failure of the application.
- It is used to find out the software weakness.
The following are some of the top negative test cases that one must consider while testing an application:
Required Data entry: The application should clearly mention what data is needed to enter into the field.
Field type test: Each field should mention the type of the data that is to be entered. For example numeric type, character type, date type.
Field size test: Each field should mention the size of the data which needs to be entered. For example the phone number field should contain only 10 integer numbers.
Numeric bound: For the numeric filed it is necessary to check the upper bound and lower bound.
Date field validity: The validity of date field should be checked. It is important to validate that the invalid dates are not allowed. for e.g. 04/32/2007
Advantages of negative testing:
- Negative testing tells us what the application should not do.
- Quality of the application is improved.