Blog

A Beginner’s Guide to Negative Testing

Negative Testing

What is Negative Testing?

Negative testing is a testing process in which system or application is checked with invalid input data. The purpose of negative testing is to verify whether the system is behaving as you are expecting or not, for invalid input data; whether the system shows any error message when it is supposed to and doesn’t show any error message when it is not supposed to. Negative testing is the main part of your testing effort. With negative testing, we have to verify that to what extent does the application keeps itself stable in different situations for invalid input data for which it is not designed.

Tips for Designing Negative Test Cases:

The main emphasis of QA engineer should be on the requirements of software. If requirements are clear then it will be very easy for him/her to design negative test cases. Following are some examples that will be helpful for you to design negative test cases.

There is a form in application that contains age text box field and submit button. The requirement is that the age text box field can only accept integer values. Being a QA engineer we will have to test the application with all possible positive and negative scenarios. For positive test, we will put integer value in the field like “12” and press submit button. Now we will make its negative test cases.

  • We will put some character string like “abcd” in age text box field and check whether the system shows any error message against invalid input or not.
  • Try to populate form with empty field.
  • Check field limitation for input data using boundary value analysis and equivalence partitioning techniques.
  • Put value that is more than its highest boundary value.
  • Put value that is less than its lowest boundary value.

 

Negative Testing means to test the product in a way that is against the requirements like for instance consider a scenario, “On the off chance that you enter any number between 5 to 10, you ought to have the capacity to go to the next page or else you ought to get a popup saying “enter the numbers somewhere between 5 and 10) and ought not have the capacity to go to the next page”.

Negative situation: Unable to go to the next page by entering invalid information.

From the above negative situation various experiments can be inferred.

  • Test Case 1: Unable to go to the next page by entering negative whole numbers in the content field.
  • Test Case 2: Unable to go to the next page by entering positive numbers more noteworthy than 10.
  • Test Case 3: Unable to go to the next page by entering positive number less than 5.

Have a look at another example to completely understand the concept of Negative Testing.

Let’s suppose on a form there is field of “ID” and client asks you to perform negative testing. In that case; you can try few sample negative test cases stated below:

  • Enter characters in the ID field and observe the application response.
  • Try to populate the field with –ve figures.
  • Try to enter symbols in the field and observe the application behavior.
  • Put value that is more than its highest boundary value.
  • Put value that is less than its lowest boundary value.
  • Try to submit the form without putting any value in the ID field.

This is how you can derive numerous negative test scenarios against a particular requirement.

 

Another example can be that “the application will take two numbers as input and give a number as output which is the sum of two input numbers.” From negative perspective, when the user will try to perform this operation using another arithmetic operator then it should give a proper error message like “you are using invalid operator” etc. The result of positive test is often quite clear because the tester is mostly aware of the expected behavior against the requirement. Whereas the end result of negative test is unclear because different result is produced against each negative test. The most important thing for test designer is to produce different negative test cases against each single requirement. The tricky part comes up at that time when the result against each negative test case may be different from your expected results. In such cases you should consult with the developers and discuss about the results with them.

The objective of negative testing is to figure out the issues where application does not support unexpected situations. Therefore, the expected results of negative test cases are not just used to verify the functionality of the application but also to evaluate what will be the user experience with the application.