Open In App

Positive vs Negative vs Destructive Test Cases

Improve
Improve
Like Article
Like
Save
Share
Report

A test case is a set of conditions or variables under which a tester will determine whether an application, software system or website meets specifications and performs as expected. A test case can be positive or negative, meaning that it tests for the correct functionality or missing functionality. 

What are Test Cases?

A test case is a set of conditions or variables under which a tester will determine whether an application, software system or one of its features is working as it should. There are three main types of test cases:

  • Positive test cases: These are ones in which the system being tested is expected to work correctly. These tests are designed to show that the system can handle valid input and produce the expected output.
  • Negative test cases: These are those in which the system being tested is expected to fail. These tests help ensure that the system can handle invalid input gracefully and produce error messages or other appropriate outputs when necessary.
  • Destructive test cases: These are those in which the system being tested is deliberately broken in order to test its recovery capabilities. These tests help ensure that the system can withstand unexpected failures and still function properly.

What are Positive Test Cases?

Positive test cases are tests that verify a system or application’s ability to function correctly under valid or expected input conditions. 

  • Examples of positive test cases include verifying proper data output from a form submission, verifying a user can successfully log in to an application, or confirming that a payment transaction is successful. 
  • Positive test cases are essential for software quality assurance and help ensure that a system behaves as expected and produces the correct results when given valid input.
  • Positive test cases are used to evaluate how a system or application will behave when given valid input, or under ideal conditions. 
  • These tests help to ensure that the application behaves as expected and that the user experience is satisfactory. 
  • Positive test cases should be written for all features and functions of an application and should include test cases for boundary values and edge cases. 
  • Positive test cases are generally written by a QA engineer or tester who has a deep understanding of the application or system being tested. 
  • The tester should have a clear understanding of the functionality and desired results, and should be familiar with the application’s source code and design.

What are Negative Test Cases?

Negative test cases are used to test the system for invalid inputs and unexpected behaviors. They are designed to ensure that the system behaves as expected when given invalid or unexpected inputs. 

  • Negative test cases are important because they can uncover errors that would otherwise remain undetected. 
  • Negative test cases are those tests that are designed to prove that a system does not work as expected when given invalid inputs. For example, a negative test case for a login system might be entering an incorrect username and password combination. This would ensure that the system does not authenticate a user who does not have the correct credentials.
  • Negative test cases can also be used to check for unexpected behaviors. For example, a negative test case for a search engine might be to enter a query with an unexpected format. This would ensure that the system does not provide unexpected results when given unexpected input. 
  • Negative test cases are also important for ensuring that the system is secure. 
  • They can be used to test for input validation, authentication, authorization, access control, and other security measures. For example, a negative test case for an authentication system might be entering an invalid username or password. This would ensure that the system does not authenticate a user who does not have the correct credentials.

What are Destructive Test Cases?

Destructive test cases are a type of software testing that is designed to identify software failures that occur when the system is exposed to extreme conditions. These tests involve deliberately subjecting a system to unusual or extreme conditions to identify its breaking points and the extent of the damage caused. 

  • The purpose of destructive tests is to identify potential system failures before they occur in the field and to help ensure the system can withstand these conditions.
  • Destructive tests can involve a variety of scenarios, such as deliberately introducing incorrect data, overloading a system with more requests than it can handle, or simulating extreme temperatures that may cause hardware to malfunction. 
  • These tests are designed to simulate real-world conditions and uncover any hidden weaknesses in the system. This can help identify and address any issues before the system is released to users, ensuring a more reliable product.
  • Destructive tests are typically conducted in a controlled environment, where the test conditions can be closely monitored and the system can be quickly restored to its original state. 
  • This makes it easier to track the results of the tests, identify any issues, and develop solutions. 

Destructive tests are not the only type of software testing. Other types of software testing include functional testing, regression testing, and performance testing. Each type of software testing has its own benefits and can be used in conjunction with destructive tests to provide a comprehensive view of the system.

Positive Test Cases vs Negative Test Cases vs Destructive Test Cases

Below are the differences between positive test cases, negative test cases, and destructive test cases: 

Factor  Positive Test Cases Negative Test Cases Destructive Test Cases
Functionality Test cases that test the basic functionality of the software. Test cases that test for errors or unexpected behavior. Test cases that delete or modify data.
Usability Test cases that test for user-friendliness and easy navigation. Test cases that test for confusing interfaces or difficult navigation. Test cases that delete user data or preferences.
Performance Test cases that test for fast loading times and response times. Test cases that test for slow loading times and response times. Test cases that delete cached data or user preferences.
Security Test cases that test for proper authentication and authorization. Test cases that test for vulnerabilities and exploits. Test cases that delete user data or preferences.
Design Test cases are tests that are designed to ensure that a system works as expected. Test cases are tests that are designed to ensure that a system does not work as expected. Test cases are tests that are designed to deliberately break a system in order to test its robustness.
Data A positive test case is run on unaltered data A negative test case is run on altered data A destructive test case is run on permanently altered data.
Example
  • The software should allow a user to input their username and password in order to log in.
  • The software should allow the user to view all of their past and current orders.
  • The software should allow the user to view the details of a specific order.
  • The software should allow the user to search for an order by order number.
  • The software should not allow a user to log in with an invalid username and password.
  • The software should not allow the user to view orders they do not have permission to access.
  • The software should not allow the user to view the details of an order they do not have permission to access.
  • The software should not allow the user to search for an order by an invalid order number.
  • The software should allow a user to log in with a valid username and password.
  • The software should allow the user to view all of their past and current orders.
  • The software should allow the user to view the details of a specific order.
  • The software should allow the user to search for an order by order number.

How to choose which type of test case to use?

When deciding which type of test case to use, there are a few factors to consider:

  • What you are testing for: If you are trying to find bugs in your software, then you will want to use positive test cases. These test for the expected behavior of the software. If you are trying to see how your software reacts when it encounters unexpected input, then you will want to use negative test cases. These test for unexpected behavior of the software. Finally, if you are trying to determine if your software can handle extreme conditions (such as large amounts of data), then you will want to use destructive test cases. These purposely attempt to break the software in order to see how it responds.
  • Time: Positive and negative test cases can be written relatively quickly since they only require a few different input values. Destructive test cases take much longer to write since they must be very specific and carefully crafted in order to have a chance at breaking the software.
  • Cost: Destructive test cases are by far the most expensive type of test case since they often require specialized hardware and/or environments in order to run properly. Positive and negative test cases are much less expensive since they can be run on any system with no special requirements. Considering all of these factors will help you decide which type of test case is right for your needs.


Last Updated : 02 Dec, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads