Everything You Need to Know About Negative Test Cases

By Kate Eby | April 14, 2019 (updated March 15, 2024)

In this article, you’ll find an overview of negative testing, including how to create negative test cases with expert examples and downloadable test case templates. You’ll also learn how negative testing improves software development.

Included on this page, you'll find a variety of test case templates, like a test case planning and execution template, an SQL server integration services testing test case template, a manual testing test case template, an automation test case template, and many more.

What Is a Test Case?

Test cases are a set of documented actions — the how-to steps — that govern the observation and analysis of a specific software requirement. A formal test case uses one positive and one negative test per requirement.

For more information on the full range of concepts associated with test cases, including the proper test case format, tips on creating a good test case, and more on positive test cases and testing, read this guide to the essentials of test cases.

 

What Is Negative Testing?

In software testing, positive testing refers to the process of testing a system under test (SUT) or application under test (AUT) by evaluating expected behavior against a requirement. Negative testing, sometimes referred to as failure testing or error-path testing, is the practice of finding useful feedback when things go wrong.

Negative testing uses invalid input data, or undesired user behaviors, to check for unexpected system errors. Put another way, a tester takes invalid inputs and tests the user interface (UI) of a web application (the most common use of negative testing), expecting the unexpected to take place. This practice seeks to discover what happens to the AUT under adverse conditions.

What Is the Purpose of Negative Testing?

Negative testing is a quality control practice that ensures complete test coverage in software development. By purposefully attempting to crash an SUT or by using poor data to find unknown defects (bugs), a tester or developer discovers ways in which the SUT can be more stable and more reliable. By proving what the software should not do or accept, the tester checks that the code meets each requirement.

What Is a Negative Test Case?

 

Neil Price Jones

A negative test case is “written to prove something the software should not do or accept,” says Neil Price-Jones, President of NVP Software Solutions. He adds, “Negative test cases ensure that if a user tries something that was not considered in the design or coding, then they get the correct response or error message or at least cannot get to someplace they are not supposed to be.”

What Is the Difference Between Positive and Negative and Destructive Test Cases?

Negative and positive testing are simultaneous activities that you document using a test case. “A positive test case ensures that something included in the requirements or design works as intended. Negative test cases check everything else,” says Price-Jones.

Another term associated with negative testing is destructive testing, which, according to Price-Jones, “you can run via negative test cases (and you should if you need to document everything that you’ve done and provide proof) or use simply as an attempt to break the software by any means possible.”

For example, it is common for a web-based application to ask the user to populate the Password text field within a certain range of characters (for example, more than six and fewer than 12). Using positive testing, the tester enters passwords within the correct range. For the corresponding negative testing, the tester enters passwords that fall outside of these parameters (for example, fewer than six, more than 12, or zero characters) to test how the AUT responds. This type of negative testing is known as boundary-value analysis testing.

How to Identify Negative Test Cases

How do you determine what data to use or undesirable action to take in order to create and execute useful negative test cases? To identify negative test cases, start with the positive. Each positive test case is created by analyzing the business/user requirements, artifacts, and software design documents. Use each positive test case scenario to identify the negative test case by utilizing information not found in the documents.

You must balance time and resources to meet software requirements. Negative testing faces resistance due to project schedules, availability of qualified people, release dates, and budgets. Without subjecting the SUT to actual damage, software testers use experience and intuition to decide how, when, and where to use negative testing and identify test case steps. It is not feasible to practice exhaustive negative testing or create negative test cases that provide perfect test coverage of the SUT.

Test Case Planning and Execution Template

 

Test Casde Planning and Execution Template

Use this test case planning and execution template to map out test plans for your software development project, execute test case steps, and analyze test data. It is designed to track tests by test ID and name, identify each stage of a test, add priority levels and notes, and compare actual versus expected results.

Download Test Case Planning and Execution Template

Excel | Word | PDF | Smartsheet

 

How to Design a Negative Test Case

In software testing, when the amount of possible inputs is too large for complete, cost-effective test coverage, an orthogonal array offers an efficient model for designing negative test cases (that is, finding software errors and eliminating duplicate tests). This model is commonly used for UI testing, regression testing, and performance testing of the SUT.

Neil Price-Jones approaches negative test case design in systematic terms: “One way is thinking orthogonally to the flow of a transaction in a standard business scenario and then thinking about what can go wrong at each step of that process.”

“If you think about the transaction as flowing through steps from left to right (that is, in a linear fashion), then you can think of testing it (both positive-wise and negative-wise) by looking at each step from above and seeing what would be the positive (which lets the transaction flow to the next step) and the negative (which should stop the transaction from flowing to the next step),” explains Price-Jones.

Negative Test Case Format

Positive and negative test cases share the same format, which typically includes the following attributes:

  • Test case statement

  • Test setup

  • Test case ID

  • Test scenario

  • Negative test steps

  • Negative test data

  • Expected results

  • Actual results

  • Pass/fail confirmation

  • Additional comments

How to Write a Negative Test Case

Put simply, you write a negative test case by selecting the invalid input data or undesired user behavior that you acquire by performing positive test case steps. Price-Jones recommends starting with the positive test case criteria, which you define by test scenarios from a business requirement.

“Start with what is defined and included and then consider all the other possibilities by using test design techniques. Sometimes, I refer to this as variations on a theme,” he says.

Like a positive test case, a negative test case is a single executable test that you document either by using spreadsheets or test management software. Adopting a standard format for test case documentation helps in the following ways:

  • It saves time.

  • It makes each test case accessible by multiple stakeholders regardless of technical knowledge.

  • It is reusable for similar test plan scenarios.

  • It helps streamline overall communication within the test and development teams.

For a more detailed breakdown of negative test case attributes and a step-by-step guide for how to write a test case in Microsoft Excel, read “How to Write Test Cases: The Essential Guide.”

Negative Test Case Examples for a Login Page

Price-Jones reflects on a time he found amusement in using negative testing for a login page: “I once tested a login for a publicly available application where three incorrect tries actually got you into the software (rather than suspending you for 30 minutes or forcing you to reset the password). The programmer had flipped the switch at the end of three tries to allow you in rather than reject you.”

The following negative test case examples apply to positive test cases that pass with expected results for the AUT login page when using the correct user ID and password:

  • Blank user ID with blank password

  • Correct user ID with incorrect password

  • Incorrect user ID with correct password

  • Incorrect user ID with incorrect password

  • SQL injection in password

  • SQL injection in user ID

  • SQL injection in both fields

SQL Server Integration Services Testing Test Case Template

 

SQL Server Integration Services Testing Test Case Template

Manage, test, and track all SQL server integration services with this detailed test case template. Use the template to test feature updates and ensure that all programming and data management systems work correctly.

Download SQL Server Integration Services Testing Test Case Template
Excel | PDF

Negative Test Case Examples for Wireless Network Access

The following negative test case examples apply to positive test cases that pass with expected results when the correct network security key (password) is used and user agreements are confirmed:

  • Access locks the network with an invalid key input.

  • Access locks the network without a security key.

  • Enter an invalid code or invalid characters into the key field.

Negative Test Case Examples for Connecting Bluetooth Devices

The following negative test case examples apply to positive test cases that pass with expected results when a Bluetooth device is discovered or paired with valid data and a successful connection range is achieved:

  • Enter one incorrect code and fail connection.

  • Repeat with both devices in sequence.

  • Turn off Bluetooth on each machine separately.

  • Re-establish the connection between devices.

  • Test incompatible devices.

  • Test with restricted devices (those that limit connections).

Negative Test Case Examples for Online Shopping Carts

The following negative test case examples apply to positive test cases that pass with expected results when there is sufficient inventory, a valid payment method, and confirmation from the payment provider, along with multiple items in the cart:

  • Purchase more than the available inventory. (According to Price-Jones, “Many shopping carts would cover this case with a requirement to either inform you that the item is unavailable or to set up a back order, so you could argue it is a positive case.”)

  • Purchase multiple items, some of which are not available.

  • Purchase and receive “failed payment.”

  • Purchase and receive “failed shipping location” (aka “cannot ship to your location”).

  • Abandon the purchase at any point in the process.

  • Disconnect at any point in the purchase process.

Negative Test Case Examples for Credit Card Payments

Price-Jones provides the following example of negative test case steps for a credit card payment form when the positive test case inputs are the correct credit card number, the correct CVV (or CVC) code, the correct name, and the correct billing address:

  • Incorrect check digits

  • Incorrect number with the wrong digits

  • Invalid billing address

  • Invalid CVV number

  • Invalid name

Negative Test Case Management: Manual or Automated Testing?

Negative testing is primarily a manual activity and is historically managed using spreadsheets. With test automation software, you can work with tools that let you create negative test cases using valid and invalid data to improve test coverage of the AUT with positive and negative testing scenarios. The process of determining when to automate negative testing or when to use manual negative testing varies based on the test planning, the business or user requirements, the availability of qualified software testers, and the budget.

Testers can manually write automated test scripts (i.e., software code) to help with test case steps that require a large amount of input data, or they can use test management tools to set up reusable automated scripts. Software solutions like TestComplete and Selenium feature automated test script management, version control, and reporting capabilities across different requirements. The most commonly advertised benefits of these solutions include test case templates, test versioning, automated bug tracking with email notifications to assigned developers, controlled collaboration access, traceable test coverage by requirement, and cloud backup storage.

Manual Testing Test Case Template

 

Manual Testing Test Case Template

Creating negative test cases from scratch is a time-consuming endeavor because the SUT constantly changes. Use this manual testing test case template to record negative testing steps, analyze expected results versus actual results, and determine a pass/fail result. It is designed to manually record each step of the negative testing process, the test ID and name, and additional notes to consider during analysis.

Download Manual Testing Test Case Template

Excel | Word | PDF

 

Automation Testing Test Case Template

 

Automation Testing Test Case Template

Use this automation testing test case template to review the success or failure of automated software tests. Download and fill out this form to document the test name and ID, the test duration, each step and component, and any notes about the test, including the automated test scripts.

Download Automation Testing Test Case Template

Excel | PDF

False Positives and Negatives in Negative Testing

In software testing, a false positive result refers to a failed test case result that occurs when there is no defect and the SUT is functioning properly. When a test case passes but a defect is present in the SUT, the result is known as a false negative result. Manual negative testing activity, such as sanity testing (doing a run-through to ensure that a particular aspect of the software is performing roughly as expected) and testing for opposite cases (forcing a passing test case outcome to fail), helps you avoid false positive results.

To reduce false results prior to incorporating automated test scripts or automation tools, be sure to put proper measures in place during test planning and when creating negative test cases. Use a template that accounts for any automated test scripts that are specifically designed to avoid false positive or negative test cases.

User Acceptance Testing Test Case Template

 

User Acceptance Testing Test Case Template

Download this comprehensive user acceptance testing test case template to ensure that it matches the SRS document and meets all provided requirements. The document is designed to track individual applications, execution steps, and expected and actual results.

Download User Acceptance Testing Test Case Template

Excel | PDF

Improve Negative Test Cases with Smartsheet for Software Development

Empower your people to go above and beyond with a flexible platform designed to match the needs of your team — and adapt as those needs change. 

The Smartsheet platform makes it easy to plan, capture, manage, and report on work from anywhere, helping your team be more effective and get more done. Report on key metrics and get real-time visibility into work as it happens with roll-up reports, dashboards, and automated workflows built to keep your team connected and informed. 

When teams have clarity into the work getting done, there’s no telling how much more they can accomplish in the same amount of time. Try Smartsheet for free, today.

 

 

 

Discover why over 90% of Fortune 100 companies trust Smartsheet to get work done.

Get free Smartsheet templates Get a Free Smartsheet Demo