The primary goal of any test team is optimal product quality. Using an effective quality assurance policy a test team attemts to determine the maximum defects during their testing.
We know that finding defects is the main goal of a Test Team. A Test Team must create test cases to ensure that the application or product performs the way it is supposed to.
It is definitely important to verify that software performs its basic functionality as intended, it is equally important that software is able to handle abnormal (negative) situations.
So, Negative Testing is equally important as compare to Positive Testing. So, let's start to explain Negative Testing.
Definition of Negative Testing: Negative Testing is commonly referred to as error path testing or failure testing. It is generally done to ensure the stability of the application.
Let's discuss why Negative Testing is necessary. The main purpose of Negative Testing is to determine the negative scenario under which software crashes or performs abnormally. Finally, it ensures that there is sufficient error validation present in the software.
Example of Negative Testing
First pane
In the first one, the user is expected to provide a name to the policy as shown below:
Let's also get some ground rules to ensure we design good positive and negative scenarios.
Requirements
- The name text box is a necessary parameter.
- The description is not mandatory.
- The name box can have only a-z and A-Z characters. No numbers or special characters are allowed.
- Name can be maximum 10 characters long.
Negative test cases: The following are some Negative Testing scenarios for this specific pane.
- ghtouiouoiuiiiuu (name exceeding 10 characters)
- abcd1234 (name having numerical values)
- No name supplied
- sndddwwww_ (name containing special characters)
- ... and so on
Basic factors that help in Writing Negative tests
The following are two methods that help to determine a maximum Negative Testing scenario:
- Boundary Value analysis
- Equivalence partitioning
Boundary value Analysis
As the name itself implies, boundary indicates limits to something. Hence this involves designing test scenarios that only focus on the boundary values and validates how the application behaves. Therefore if the inputs are supplied within the boundary values then it is considered to be Positive Testing and inputs beyond the boundary values are considered to be a part of Negative Testing.
For example, if a specific application accepts VLAN Ids in the range 0 – 255. Hence here 0, 255 will form the boundary values. Any inputs going below 0 or above 255 will be considered invalid and hence will constitute Negative Testing.
Equivalence Partitioning:
In Equivalence partitioning, the test data are segregated into various partitions. These partitions are referred to as equivalence data classes. It is assumed that the various input data (data can be a condition) in each partition behaves the same way. Hence only one specific condition or situation needs to be tested from each partition, as if one works then all the others in that partition is assumed to work. Similarly if one condition in a partition doesn't work, then none of the others will work.
Therefore it's now very apparent that valid data classes (in the partitions) will comprise Positive Testing whereas invalid data classes will comprise Negative Testing.
In the same VLAN example above, the values can be divided into, say, two partitions.
So the two partitions here would be:
- Values: 255 to -1 in one partition
- Values 0 to 255 in another partition
Conclusion
Creating a high-quality software product with Positive Testing and Negative Testing are equally important.
To create a good in-depth negative scenario a tester needs creativity, skill and intelligence.