Why Testing Process Needs Negative Testing?

The main function of a testing team is to determine maximum number of bugs during testing, so that the product will be defect free and the quality of the product is not compromised for any reason.

The main function of a testing team is to determine maximum number of bugs during testing, so that the product will be defect free and the quality of the product is not compromised for any reason.

A test team designs an effective test case to find out bugs in every possible way. It is normally very important to test that the software performs basic functionalities as per the requirements; however, it is equally important that the software is able to handle the negative (abnormal) situations gracefully.

So negative testing is equally important and needed compared to the positive testing. We are going to see the need for negative testing and also how it works.

Negative Testing:

Testing a functionality with invalid set of inputs is called as negative testing. It is mainly performed to test the stability of the application. Negative testing is also called as error path testing or failure testing.

Purpose of Negative testing:

The main purpose of negative testing is to determine the software is built in such a way that it will not crash or perform abnormally at the negative scenarios. Finally, it is also used to ensure appropriate validations are performed by the software.

Example of Negative testing:

negative testing

Requirements for the above text box implementation:

  1. The Name text box is a mandatory field.
  2. The text box can have a-z or A-Z and no numbers, and special character are allowed.
  3. Name can be maximum of 6 characters long.

Negative test cases:

The following are some of the negative test cases for the above requirement.

1. Clicking “OK” without entering values (no name entered)

2. “kalyankumar” (name exceeding six characters)

3. mst123 (name has numeric values)

4. test_s (name has a special character)

5. **** ( inappropriate words)

Basic methods for writing Negative test cases:

There are two major methods to determine maximum number of negative scenarios:

  1. Boundary value analysis
  2. Equivalence Partitioning

Boundary value analysis:

From the name of this method, we can easily understand that the data used in the testing only depend upon the boundary of the requirement. If the boundary value is within the limit, then it is called as positive testing, and if the boundary value is beyond the limit, then it is called as negative testing. The state of the application should be tested beyond the boundary value and is analysed; so that exceptions can be handled accordingly.

negative testing

Example:

If an input range for an input box is set as 6-10 characters, then testing characters above 10 and below 6 is called as negative testing. The boundary range here is 6 and 10 (6-min, 10-max)

Equivalence Partitioning:

Equivalence partitioning (also called Equivalence Class Partitioning or ECP) is a software testing technique that divides the input data of a software unit into multiple partitions of equivalent data from which test cases can be derived. In principle, test cases are designed to cover each partition at least once.

Here, a single input from each partition is taken and tested, and the remaining input data are assumed to be working fine. Similarly if that single input does not work, then the remaining inputs in the same partition will not work. Here the valid data classes are called as positive testing and invalid data classes are called as negative testing.

Example:

A store offers different discounts on the purchases made by the customers. Below, you can see the range of purchase values that will earn different discounts; now, we need to test whether the software calculates the discounts correctly or not.

Conditions: If the purchase amount is in the range of $1 to $50, then there is no discount.

If the purchase amount is in the range of $51 to $200, then 5% discount

If the purchase amount is in the range of $201 to $500, then 10% discount

If the purchase amount is above $500, then 15% discount

Now, the valid 4 equivalence partition and single invalid partition are shown below.

Invalid PartitionValid Partition (No Discounts)Valid Partition (5%)Valid Partition (10%)Valid Partition (15%)
$0.01$1-$50$51-$200$201-$500$501-Above

From the above the values in the valid data classes will be of positive testing and values from invalid data classes will result in negative testing.

Thus, a tester must equally concentrate on negative testing as well as on positive testing.

References:

Negative Testing

About MST

At MST Solutions our cornerstone is to adapt, engage and create solutions which guarantee the success of our clients. The talent of our team and experiences in varied business verticals gives us an advantage over other competitors.

Recent Articles

Work with us.

Our people aren’t just employees, they are key to the success of our business. We recognize the strengths of each individual and allow them time and resources to further develop those skills, crafting a culture of leaders who are passionate about where they are going within our organization.