Positive Testing and Negative Testing with Examples

Software TestingTesting ToolsAutomation Testing

Software testing is the process of evaluating and verifying a software program to ensure that it functions properly. The goal is to identify flaws and enhance product quality. There are two methods for testing software: Positive Testing and Negative Testing.

Positive Testing

Positive testing is a sort of testing that is conducted on a software program using legitimate data sets as input. It determines whether or whether the software program acts as predicted when given favorable input. Positive testing is done to ensure that the software program accomplishes precisely what it is supposed to accomplish.

Example − In an app, there is a text field that can only receive digits. The system will receive values up to 99999, and any additional numbers must not be accepted. To do positive testing, alter the valid input values from 0 to 99999 and see if the system accepts the inputs.

Negative Testing

Negative testing is a way of evaluating a software program that uses faulty or incorrect sets of data as input. It determines if the software program responds as predicted to negative or inappropriate user input. Negative testing ensures that the software program does not collapse and stays stable in the presence of incorrect data inputs.

Example − Negative testing can be carried out by inputting characters ranging from A to Z or from a to Z. Either the software system must reject the values, or it should provide an error message in response to these erroneous data inputs.

The following factors must be considered in both tests −

  • Input data

  • An activity that must be carried out

  • Output Result

Testing Technique used for Positive and Negative Testing

The following procedures are being used for positive and negative testing verification −

  • Boundary Value Analysis

  • Equivalence Partitioning

Boundary Value Analysis

This is a software testing methodology in which test cases are written with values at the border in mind. Positive testing occurs when the input data is used inside the boundary value limitations. Negative Testing occurs when the input data is selected outside of the boundary value limitations.

Example − A system can take numeric values ranging from 0 to 10. All other digits are null and void. The boundary values -1,0,1 and 9,10,11 will be examined using this methodology.

Equivalence Partitioning

This is a software testing methodology that separates input data into many parts. Each partition's values must be checked at least once. Positive Testing employs partitions with valid values. Negative testing is performed on partitions with incorrect values.

Example − The numbers 0 to 10 can be split into two (or three) parts. We have two divisions in our case: -10 to -1 and 0 to 10. To test the scenarios, sample values (5 and -5) may be taken from each section.

Conclusion

Testing aids in the delivery of high-quality software applications and assures that the program is glitch-free before it is released. Use both positive and negative testing to ensure sufficient confidence in the quality of the program. Actual users can enter any value, which must be checked before the launch.

raja
Published on 09-Jun-2021 12:07:04
Advertisements