e-Zest members share technology ideas to foster digital transformation.

Importance of Positive & Negative Scenarios in Testing

Written by Kirti Mansabdar | Oct 20, 2016 6:00:00 AM

Testing is a vital part of project delivery that it has become unthinkable to neglect or spend less time on it. There are so many ways to test an application; it doesn’t matters which way you have taken. Having said this, it’s important to consider both positive as well as negative test scenarios and more attention towards negative scenarios.

We commonly some across testing positive scenarios but testing a negative scenario is more important. Most of the bugs are found during the negative testing. Positive path should work but how the system or application behaves in negative scenarios has to be keenly observed. We need to keep an eagle eye on this aspect while releasing the application.

Positive Testing:

Positive testing means testing the happy path of the functionality. Application should meet the business requirements. Consider the following example:

There is one text box which accepts only numbers/ integer values; say the range is from 0 to 10. That means the all positive test falls in between 0 to 10’s range. Here are the ways to test the text box:

  1. By entering: 2
  2. By entering: 5
  3. By entering: 7
  4. By entering: 10

Clearly positive testing is carried out using the values which falls in the given specified range.

Negative Testing

Negative testing means testing the application off beat, so that we can understand the behavior of the application to the negative entries. Consider the same example. Here are the possible ways to carry out the negative testing for the text box:

  1. By entering alphabets. Ex: abcd
  2. By entering special characters. Ex: @#*
  3. By entering alphanumeric values. Ex: abc12
  4. By entering floating value. Ex: 12.34
  5. By using boundary value analysis & Equivalence Partitioning techniques

 In all mentioned ways, validation message should be displayed as, “Please enter only numbers” etc. First four ways are easy to understand, we will directly go to the last one that is boundary value analysis & Equivalence Partitioning techniques.

  • Boundary Value Analysis

Most of the bugs are found during this technique. In simple words, checking the boundary limits of the given range is nothing but Boundary Value Analysis. Now consider the above example, range is specified as 0 to 10, means we need to test the application using one below the boundary and one above the boundary, that is we should test the text box for -1 (one less than lower limit) and for 11 (one greater than upper limit) values.

When the application is tested using the values given in this range then it is called as positive testing, but when the values are chosen out of the range it is called as negative testing. We have to test the application in both the ways. Positive testing to confirm, application meets business requirements and negative testing to understand the behavior to the negative entries.

  • Equivalence Partitioning

This is also another technique to find out the bugs. In this technique we divide the given ranges in 2/3 equal parts and then carry out the testing, so probably the chances of getting bugs are more. Consider above example, range is 0 to 10 integer values, then divide this in two groups so the groups would be {0 to 5} and {6 to 10}. If the test is passed by entering numbers 0 and 5 that means test case is pass for all the values that falls in the range of {0 to 5}.

We have to test the application using boundary values as well as Equivalence Partitioning techniques. For above example we can consider the set of values as: {-1, 0 to 5, 6 to 10, 11} where:

-1 is one less than lower limit

0 to 5 & 6 to10 is Equivalence Partitions

11 is one more than upper limit

Equivalence Partitioning technique is used in both the testing scenarios that is positive as well as in negative testing. Same partition can be used while doing positive testing so that it will reduce the time & efforts.