Software Testing Knowledge Base
QA Madness Knowledge Base Testing types

How to Run Negative Testing & Is It That Necessary?

Have you ever heard of positive and negative testing? These are some of the basic QA concepts, so we can’t help but talk about them.

When a QA specialist performs a positive test, they check if software works as intended. A negative test, in turn, evaluates what happens if someone uses a nontypical, unexpected input. Will software be able to respond correctly? And what does “correctly” mean under such circumstances? That’s what we’ll try to explain in this article.

What Is Negative Testing?

In a nutshell, negative testing ensures that your application can handle invalid input and unexpected user behavior. To be more specific, it verifies that the system can handle invalid inputs responding with error messages and not allowing the software to perform in a certain way.

positive and negative test

Let’s take a close look at the negative testing by comparing it to the positive. Let’s take an ordinary elevator in the QA Madness’ office as an example and examine how it works.

Negative testing will answer the following questions:

  • What happens if the number of people (or their total weight) is less than the minimum specified limit?
  • What happens if a fire starts inside the elevator?
  • What happens in case of a power outage?

Meanwhile, we work with normal conditions for running positive tests:

  • Only the specified number of people enter the elevator.
  • There is no smoke or fire in the elevator.
  • There is no power loss.

How to Conduct Negative Testing?

To write a negative test case, select invalid input data or unwanted user behavior that would be useful to check. Indicate the expected result for this unexpected action. As a rule, it will be “failed.”

In our blog, you can find a guide for creating test cases, positive and negative ones. Read and refresh your memory. Generally, the logic of writing positive and negative test scenarios is similar. Just remember that negative testing intends to identify possible program failures under any circumstances.

Negative Test Case Example

ID: TC-1.1

Summary: Check the registration with empty required fields.

Steps to reproduce:

  1. Open the Homepage: https://www.skullcandy.com/*.
  2. Tap the “Sign in” icon.
  3. Click the “Sign in” button.

Expected result: A user cannot register. The error message is displayed.

Positive and negative tests
* The QA Madness team hasn’t tested this website, the link and screenshot are for illustrative purposes only.

Typical Negative Testing Scenarios

The purpose of negative testing is to detect potential errors and application crashes in different situations. You can find several examples of such situations below:

  • Filling in the mandatory fields
    Some applications and web pages contain fields that are marked as required. Create a test that leaves such fields empty and analyze the response of the tested software.
  • Matching data and field types
    Typically, online forms and dialogue boxes are designed to accept specific data types and formats (text, number, date and time, etc). Enter data that doesn’t match this requirement to verify whether the application responds properly.
  • Permitted data bounds and limits
    Applications can use input fields that accept data in a certain range. In this case, build a negative test case that enters a value smaller than the lower acceptable bound or greater than the upper limit of the specified field.
  • Character limit
    Some applications and web pages contain fields that allow entering a limited number of characters. This is a perfect opportunity to create a test that suggests entering more characters into the field than allowed.
  • Web session testing
    Some web browsers require a user to log in before loading any web pages. Create a test that offers opening web pages in the tested application without logging in.
  • Reasonable data
    Some applications and web pages include fields that have a reasonable limit. To check the behavior of software, create a negative test that enters invalid data into the specified field.

Is It Always Necessary to Run Negative Testing?

Since all of the QA processes are time-consuming, the decision of “what,” “how,” and “how much” to test is highly important. We can’t create a perfect bug-free system. However, we can make sure we’ve done everything to prevent those bugs. To achieve that, it’s necessary to run negative testing.

Let’s talk in more detail:

  • Even a Junior QA specialist with little experience should know how to run negative testing. With time and new projects, you’ll boost your negative testing skills and expertise.
  • Usually, there are a lot more negative than positive testing scenarios. However, we don’t recommend forgetting about the latter either:)
  • Well-written negative cases are what a client expects from a QA specialist in the first place. Oftentimes, customers already know how to do a basic checkup with positive cases.

In Conclusion

Negative testing is a crucial part of software testing that can be costly and time-consuming. Negative test cases have their pros and cons, so it’s worth remembering when, where, and how to apply them. Therefore, the best advice we can give is to learn theory and practice.