📢 Are you a TestProject user looking to migrate to an open source alternative?

Learn more
What is positive and negative testing scenarios

What are positive and negative testing scenarios in software testing with examples

Software testing is the process of evaluating and confirming a software program to ensure it functions as intended. It is designed to provide that a program works as intended and to discover flaws before it is used. There are two main methods for testing software.

1. Positive Testing

2. Negative Testing

In this article, I will discuss positive and negative testing scenarios, clearly distinguishing between them with examples to help you write good test cases for your software programs.

Positive Testing

Positive testing ensures that software performs as it is expected to do. When writing test cases for positive testing, only legitimate (valid) inputs are provided as inputs. 

In other words, positive testing is the process of evaluating a system or application using accurate input data.

The primary goal of positive testing is to validate if a software program does what it is intended to do. 

Simply put, a positive test is conducted by providing an expected set of values as inputs to the test cases.

Positive testing will enable developers to apprehend issues and fix them as they arise quickly. Since projects begin small and are thoroughly tested throughout all the Software Development Life Cycle phases, positive testing makes it easier for people to share knowledge about system architecture.

Examples of Positive Testing

Let’s look at some specific examples to understand negative tests better.

1. We will try to understand how a positive test works in the scenario below.

  • Let’s simulate an App where users are expected to enter their phone numbers without country code in a text field. 
  • The system will only receive numeric inputs with ten (10) digits, while The system must not accept any additional information such as letters and special characters. 
  • To do positive testing, The tester will only provide test cases for a set of numeric values with ten (10) digits to check if the system is working as expected.

2. Assuming in a software program, users are expected to choose a username name when registering.

  • The username can only be a combination of letters and numbers.
  • The App will only accept usernames with only alphanumeric characters devoid of any special characters.
  • For positive testing, the software tester will only write a test case for only alphanumeric characters.

Negative Testing

It is vice versa for positive testing. In Negative testing, a software program is evaluated against false or incorrect data.

Negative testing is also known as error path testing or failure.

It is best to check if the computer program reacts as expected to false or invalid user inputs. Negative testing ensures the software program does not crash and continues running even with wrong data inputs.

A software tester most likely starts by considering the positive inputs when considering the test scenarios. Still, it is equally important to know that understanding the importance of negative tests is always crucial. It is seen as being essential to the execution of test cases.

Negative testing ensures that the software program displays an error when it should and does not display an error when it should not. Additionally, it helps software developers find more flaws and improve the software program being tested.

Factors to consider as a software tester when performing negative tests:

1. Input data

2. Action (Activity to be carried out)

3. Output

Examples of negative Testing

Let’s look at some specific examples to understand negative tests better.

1. We will try to understand how a positive test works in the scenario below.

  • Let’s simulate an App where users are expected to enter their phone numbers without country code in a text field. 
  • However, let’s enter the unique characters and alphabet values in the text field to check whether it accepts the unique characters and alphabet inputs.
  • As a tester, you expect the text field not to accept the inputs as they are invalid values and show an error message for the incorrect entry.

2. Assuming in a software program, users are expected to choose a username name when registering.

  • The username can only be a combination of letters and numbers.
  • The App will only accept usernames with only alphanumeric characters devoid of any special characters.
  • For negative testing, the software tester will only write test cases for only usernames with alphanumeric and special characters.
  • As a tester, you expect the text field not to accept the inputs as they are invalid values and show an error message for the incorrect entry.

Examples for Positive and Negative Testing

Let’s simulate a software program with a Password text box field allowing users to enter passwords between 8 and 15 alphanumeric characters.

See the table below for various positive and negative test scenario examples.

Positive Test ScenariosNegative Test Scenarios
The Password text box should allow 8 characters input.The password text box should throw an error or should not accept when less than 8 characters are entered.
The Password text box should allow 15 characters of input.The password text box should throw an error or should not accept when more than 15 characters are entered.
Any values between 8 and 15 characters long should be accepted by the Password text box.The password text box should not accept special characters as input
It should accept any combination of letters and numbers in Password text box.The password text box should not accept acombination of numbers only or acombination of letters only.

Difference Between Positive and Negative Testing

In this session, let us discuss some key differences between positive and negative testing.

Positive and negative testing flow chart
Positive TestingNegative Testing
Positive testing examines a software program’s response with the help of a valid input data set.Checking the software program’s response using the invalid/incorrect input data set is known as Negative testing.
Positive testing is not a guarantee of high-quality software.Negative testing ensures that the software product is of high quality.
Positive testing is executed quicker.Negative testing takes more time to execute compared to that positive testing.
Positive testing is used consistently to validate the set of test cases that are currently available.Negative testing is used consistently to break the software program (product) with an unidentified set of test cases we will use.
Positive testing’s primary goal is to ensure that the software application consistently complies with the developer’s software requirements specifications (SRS)Negative testing’s primary goal is to evaluate a software program’s consistency in the face of erroneous validation data sets.
Positive testing does not cover all possible scenarios.Negative testing encompasses all possible scenarios. 
It is a process where the program is validated against a reliable input data set.It is a process where the program is validated against the invalid input data set.
Positive testing has less impact than Negative testing.Negative testing is more crucial and significant than Positive testing.
Positive testing can be implemented on all kinds of applications.Negative testing can also be performed on all kinds of applications.
Someone with less knowledge can carry out the positive testing.Professional software testers mainly use negative testing.
It makes sure that the software program meets the required standard.Negative testing makes sure to deliver 100 percent bug-free software.
Positive testing is implemented only for the predicted conditions.Negative testing ensures that the software is completely bug-free.

Positive and Negative testing are two opposing test methods—as the name suggests—but they are also very effective at producing high-quality and bug-free software in the end.

Testing Approaches used in Positive and Negative Testing

The following basic techniques are used to verify positive and negative test cases.

  • Equivalence Partitioning
  • Boundary Value Analysis

1. Boundary Value Analysis

This software testing approach creates test cases keeping border values in mind. When the input data is used inside the boundary value constraints, this is referred to as positive testing. This is known as negative testing when the input data is chosen outside the boundary value restrictions.

Example: All other characters (Special Characters) will be nullified for a software program that accepts Alphanumeric characters only. The boundary data sets [a, b, 2, 5] and [&, %, ^, @] will be used to write test cases in this technique.

2. Equivalence Partitioning

This software testing method divides input data into numerous sections. Testers must verify the values of each partition at least once. Partitions with valid values are used in positive testing, and negative testing uses partitions with wrong values.

Example: All other characters (Special Characters) will be nullified for a software program that accepts Alphanumeric characters only. We have two divisions in our test cases, all alphanumeric values and all special characters.

The test case may take a pair of alphanumeric values and a special character from each section to write in this technique. i.e. (a, $) or (2, @)

Conclusion

We may conclude that testing ensures that the application is devoid of bugs before it is launched and helps create high-quality software applications after seeing the direct comparison between the two testing methods.

Positive and negative testing ensures that the application meets the provided business requirements and standards and gives us sufficient assurance in the software’s quality.

Both positive and negative testing ensure enough confidence in the program’s quality.

Hence, using both negative testing & positive testing methods provides sufficient certainty about the quality of an application (Final Product).

Finally, we can assert that positive and Negative testing is like the two halves of a coin, implying that we cannot ignore anyone’s importance under any circumstances.

You might also like – The Different Software Testing Types Explained


Test automation made easy

Start your smart continuous testing journey today with Testsigma.

SHARE THIS BLOG

RELATED POSTS