Negative Testing
What is Negative Testing?
Negative Testing is a software testing technique where we provide invalid, incorrect, unexpected, or unusual inputs to the application and check how it behaves.
Give the application something it should not accept and verify that it handles it correctly.
For example, if a login page requires a valid username and password, we can test:
- Wrong username
- Wrong password
- Empty username
- Empty password
- Invalid characters
- Very long input
The application should reject the invalid input, display an appropriate error message, and continue working normally.
Why is Negative Testing Important?
Negative Testing helps us verify that an application is reliable even when users make mistakes.
Main benefits:
- Finds validation issues
- Checks proper error handling
- Prevents application crashes
- Improves application stability
- Helps identify security problems
- Checks whether invalid data is rejected
- Improves user experience
- Makes the application more reliable
Negative Testing – Types
- Invalid Input Testing – Checks how the application handles wrong input.
- Empty Field Testing – Checks required fields when they are left blank.
- Boundary Testing – Tests values that are above or below the allowed limit.
- Invalid Format Testing – Checks data entered in the wrong format, like an invalid email.
- Wrong Data Type Testing – Gives the wrong type of data, like text in a number field.
- Special Character Testing – Checks how the application handles unexpected special characters.
- Invalid Login Testing – Uses wrong username or password to verify login security.
- Unauthorized Access Testing – Checks whether users can access pages they are not allowed to access.
- Negative API Testing – Sends invalid or incomplete API requests and checks the error response.
- Error Handling Testing – Checks whether the application shows the right error message instead of crashing.
Negative Testing – Interview Questions & Answers
1. What is Negative Testing?
Answer: Negative Testing checks how an application behaves when we provide invalid, incorrect, or unexpected input.
2. Why do we perform Negative Testing?
Answer: To make sure the application rejects invalid data, shows the correct error message, and does not crash.
3. Give a real-time example of Negative Testing.
Answer: Entering a wrong password on a login page and checking whether the application shows an error instead of allowing the user to log in.
4. What is the difference between Positive and Negative Testing?
Answer: Positive Testing uses valid input and checks the expected result. Negative Testing uses invalid input and checks whether the application handles it correctly.
5. What are the common types of Negative Testing?
Answer: Invalid Input, Empty Field, Boundary, Invalid Format, Wrong Data Type, Special Character, Invalid Login, Unauthorized Access, Negative API, and Error Handling Testing.
6. What is Empty Field Testing?
Answer: We leave a required field blank and check whether the correct validation message is displayed.
7. What is Boundary Negative Testing?
Answer: We test values outside the allowed range. For example, if age should be 18–60, we test 17 and 61.
8. Can Negative Testing be automated?
Answer: Yes. We can automate it using tools like Selenium, Playwright, Postman, and REST Assured.
9. What is Negative API Testing?
Answer: It means sending invalid or incomplete API requests and checking whether the API returns the expected error response.
10. What should you verify during Negative Testing?
Answer: We verify the error message, validation, status code, response, and make sure the application does not crash.
11. How do you perform Negative Testing on a login page?
Answer: We test wrong username, wrong password, empty fields, invalid formats, and unauthorized users, then verify that login is properly rejected.
12. What is the main goal of Negative Testing?
Answer: The main goal is to ensure the application handles invalid and unexpected situations safely and correctly.