![]() |
VOOZH | about |
In software testing, there are two main approaches: positive testing and negative testing. While negative testing tries to break the software by using incorrect or unexpected inputs, positive testing checks if the software works as expected when given the correct inputs.
The goal of positive testing is to make sure the system performs its intended tasks correctly when valid data is provided. It focuses on ensuring that the core functionality works as it should and that the system meets its requirements.
Table of Content
This article will explore positive testing in detail, explaining its importance in software development, how to perform it, and real-life examples to help you understand its application.
Positive testing, also known as "happy path testing," involves checking if the software works as expected with valid inputs. The main goal is to make sure that the software functions correctly when everything is in the right place.
In positive testing, you:
Positive testing is important for several reasons:
Positive testing should be done at the following stages:
Example 1:
Enter Name in Capital Letters: (as Input)
GEEKSFORGEEKSThe name is given in capital letters. So, here the requirement meets as we expected. Hence the testing is implemented correctly for Positive Testing.
Example 2:
Enter Name in Capital Letter: (as Input)
geeksforgeeksThe name is given in small letters. So, here the positive testing becomes fail because the entered input is against the requirement and It is considered as negative testing.
Example 3:
<input type="file" accept="application/pdf" required>
Condition 1: In this, it accepts only the input as file type.
Condition 2: It will only accept the file type of pdf only.If we input the PDF file type, the requirement will get fulfilled. Hence, it is considered as positive testing.
Two different techniques can be used for Positive Testing Validation-
Let's discuss these techniques in detail.
It is related to the valid partition in the input data range. It consists of 2 boundary values - upper bound and lowers bound. It checks the value of the lower boundary and upper boundary to ensure positive validation for test cases.
Example:
<input type="number" min="1" max="4">
Here,
1. The range is between 1-4.
2. The lower boundary value is 1 and the upper boundary value is 4.
3. It will get the input from this range only.
4. It will not accept the numbers from out of the given range.
5. The range from 1-4 is considered as positive test cases.
Let us consider an example
A= 1, B= 4.
The Test Cases that we designed are-
A, A+1, B-1, B.Test Case 1: Accepts A (i.e 1)
Test Case 2: Accepts A+1 (i.e 1+1 =2)
Test Case 3: Accepts B-1 (i.e 4-1=3)
Test Case 4: Accepts B (i.e 4)These are all Positive Test Cases.
In this, the test data is divided into 'n' partitions, and the input data which satisfies the valid data will be considered as positive test cases for the system.
Example: To appear for a particular exam, one should be above 18 years of age and below 33 years of age. This is the condition to appear for the exam.
Here the valid partition is in the range of 18-32 and Invalid partitions are <=17 and >=33.
Test Case 1:
if(age>=18 && age<=32)
Then "VALID"Test Case 2:
if(age <=17)
Then "INVALID"Test Case 3:
if(age >=33)
Then "INVALID"Here, Test Case 1 is the only positive test case.
In case of positive testing, it will accept only the test case 1 for the system.
Here is the Features of Positive Testing
Here is the advantages of Positive Testing
Here is the Disadvantages of Positive Testing
Here is the Tools and Techniques which is used in the positive testing.
Below are the differences between positive testing and negative testing-
| S. No | Positive Testing | Negative Testing |
|---|---|---|
| 1 . | It is always done to verify the known set of test conditions. | It is always done to break the product with an unknown set of test conditions. |
| 2. | Positive Testing is carried out by keeping the positive set of views. | Negative Testing is carried out by keeping the negative set of views. |
| 3. | It is to check the application with a valid set of data. | It is to check the application with an invalid set of data. |
| 4. | It takes less time. | It takes more time. |
| 5. | It is less efficient than Negative Testing. | It is more efficient than Positive Testing since it covers all possible test cases. |
| 6. | It returns only the expected result. | We can find some unexpected results during the testing. |
| 7. | Example: Enter the valid email id in the form by mentioning all the letters in the small case along with @ symbol. xyz@gmail.com - Positive Testing (Expected Result) | Example: Enter the invalid email id in the form by mentioning the letters in uppercase and not properly mentioned @ symbol. XYZgamil.com - Negative Testing (Error) |
Positive testing is key to making sure the software works as expected under normal conditions. It checks that the basic features and functions are working correctly, providing a solid foundation for further testing like negative testing and performance testing. By focusing on how the software behaves with valid inputs, positive testing ensures the software is ready for users and meets their needs.
While positive testing is important for confirming the software works in ideal conditions, it should be paired with other testing methods to ensure the software can handle unexpected situations, errors, and edge cases.
Positive testing, involves checking if the software works as expected with valid inputs. The main goal is to make sure that the software functions correctly when everything is in the right place.
Positive Test:
A positive test checks if the software works as expected when given valid or correct inputs. It tests the "happy path," ensuring the software performs its functions correctly under normal, expected conditions. For example, entering the correct username and password to log in to a system.Negative Test:
A negative test checks if the software can handle incorrect or invalid inputs. It tests how the system behaves when something goes wrong, such as entering the wrong password or an invalid email address. The goal is to ensure the system properly handles errors and does not crash.
Positive testing helps verify that the software works as expected, while negative testing checks for any potential issues or failures. Using both types of tests is important to find both strengths and weaknesses, ensuring the software is reliable and of high quality.