HomeTesting Concepts

What is Negative Testing?

What is Negative Testing?
Testing of any Software can be categorized into Positive and Negative. Negative Testing is a process of testing which is performed to verify whether the application is able to handle invalid inputs properly. In this testing, testers will be providing invalid inputs to the Application under test and verify whether the application is giving proper error messages to handle the invalid inputs given. This testing is performed to identify the defects which result when the application is not able to handle any invalid inputs with proper error messages. In Negative Testing, testing team will first go through the Client Requirement specifications, creates negative tests using invalid inputs and finally verifies the negative tests to check whether the application is able to handle the invalid inputs properly. In simple terms, negative testing is – “Testing the application by providing invalid data as input”.

Real world example for Negative Testing: Let’s say, we can use our mobile phone in normal conditions. But if you have to perform Negative Testing on the Mobile phone, we may need to dip it in the water or expose it to fire and check whether our Mobile phone is able to handle the water and fire properly.

Example of Negative Testing: Let’s take a text box field which can intake email address as input. In Negative Testing, we provide invalid email addresses as an input to the text fox field and verify whether that the text box field should not intake invalid email addresses by showing proper error messages. The below diagram depicts a sample negative test scenario:

Typical examples of Negative Testing: The following are few Negative Testing cases which we generally apply in day to day Testing projects:
  • Testing Mandatory / Required fields – As part of Negative Testing, we intentionally don’t enter data into the Mandatory / Required fields and submit/save the form to check whether the application is giving a proper error message stating “These fields cannot be empty”.
  • Testing Specific Data Type fields – As part of Negative Testing, we intentionally enter invalid type data into the fields. For example, if a text box fields accept Numerical values only, we perform Negative Testing on this text box field by intentionally providing Characters, Symbols to check whether the application is giving a proper error message stating “These fields can accept numerical values only”.
  • Testing fields having the limitation on size – As part of Negative Testing, we intentionally enter more characters into the text box fields for which the limitation is set to enter only a few characters. Let’s say if a text box is allowed to intake 5 characters, we perform Negative Testing by entering more than 5 characters to verify whether the application is not allowing the user to enter more than 5 characters.
  • Testing fields allowing a range of values – As part of Negative Testing, we intentionally enter a value into the fields which are out of range for the field to accept. Lets say if a text box is allowing to enter the age of the person from 18 to 44, we perform Negative Testing by entering an age value which is less than 18 or more than 44, to verify the application is giving proper error message stating “This field only accepts the age of 18 to 43”.
  • And many more.

Notes: The following points will give you more understanding on Negative Testing:
  • It is a good process to combine both Positive and Negative Testing strategies.
  • The whole purpose of Negative Testing is to verify whether the application is able to handle the invalid data properly
  • By performing Negative Testing, the quality of the application can be improved and confidence can be built on the application.
  • Negative Testing increases the test coverage and helps in making the application more stable and reliable.
  • There is no limit for creating Negative Tests and out of the box thinking plays a major role in creating a good number of Negatives Tests.

Conclusion: Negative Testing is an important process in Software Testing, where the testing is performed by providing invalid inputs to verify whether the application is able to handle invalid inputs properly.

Please leave your questions/comments/feedback below.

Happy Learning 🙂

Arun Motoori (www.QAFox.com)

Comments (0)

Leave a Reply

Your email address will not be published. Required fields are marked *