Negative Testing
Overview
This tutorial will help you understand negative testing with some examples. Negative testing is also known as Error Path testing or Failure testing.
Negative Testing
Negative testing is a type of software testing that checks how the system handles unexpected or invalid inputs or scenarios. The purpose of negative testing is to prevent the system from crashing or behaving abnormally when faced with such invalid inputs or scenarios.
Negative testing involves executing negative test scenarios or inputs. We can use test techniques such as boundary value analysis, equivalence partitioning, error guessing, or exploratory testing to generate negative test cases. We must also define each negative test case’s expected outcomes or behaviors.
Negative Test Case
A negative test case is a type of test case that verifies how well a system can handle incorrect, unexpected, or invalid inputs. Executing a negative test case is called negative testing.
Examples
Some examples of negative test cases are as follows:
Website Login Page
Consider a sample website login webpage. A negative test case is to enter an invalid username and password. The system should not grant website access to the user. The system should display an error message to the user.
E-Commerce Website
Consider an E-Commerce Website where merchants sell products online. Users are allowed to buy the products using credit cards. The process of users adding the products to the shopping cart and buying the products is called the Checkout process.
A negative test case is to add items to the cart and provide an invalid credit card. The payment gateway should display an error message. The E-commerce website should not process the payment.
Negative testing ensures the application is stable and can handle incorrect, invalid, or unexpected input scenarios without crashing, improving the product. Negative testing helps to improve the testing coverage of the application under test. Positive and negative testing approaches are essential to make the system under test more reliable, secure, and stable.
—
Software Testing Tutorials: