Negative Testing
Explored by: Pushpendra K.
Effectiveness of Test Cases
A test case is said to be effective only when both
positive and negative cases are prepared & executed.
Positive test case: Test to Pass
Negative test case: Test to Fail
So, Negative test cases should be a part of our testing
effort.
Positive Vs. Negative Test Cases
Positive test case:
Testing aimed at showing software works. Also known
as “Test to pass".
Negative test case:
Testing aimed at showing software does not work. Also
known as “Test to fail".
A Positive View of Negative Testing
It is a core skill of experienced testers and it requires
an exploratory approach to get the best value from
the time spent.
Negative Testing can find significant failures and
allow overall confidence in the quality of the system.
Testing the application with negative assumptions to
get a negative result which leads to positive one.
Can be done for Automation also (jUnit)
Aims of negative testing
Tests that aim to exercise the functionality that deals with
failure
The goals is to see how easy it is to break the system, and
having done that, how easy it was to get it up and running
again.
Discovery of faults that result in significant failures like:
Crashes, Data corruption and Security breaks
Observation and measurement of a system’s response to
external problems (Networking, Data bandwidth), error
handling & exceptions
Exposure of software weakness and potential for utilization.
Techniques to derive Negative test cases
Negative testing is not a test design technique, but rather
an approach or a classification.
Use formal test design techniques with negative input to
derive tests that can be classified as ‘Negative Tests’.
Boundary Value Analysis & Equivalence Class Partitioning
State Transition testing –
Test against known constraints – e.g. known version
Failure Mode and Effects analysis -
Concurrency - two requests, queuing, timeouts & deadlocks
Negative Test Case conditions
Required Data Entry
Field Type Test - Special characters
Field Size Test
Numeric Bounds Test - BVA
Date Bounds Test
Date Validity
Web Session Testing
Performance Changes
Embedded Single Quote
Error-handling functionality i.e. messaging
Recovery functionality i.e. fail-over, rollback and restoration
External (UI) & Internal (DB) data validation
Some more examples…
Invalid bank transaction
Violating the order in which the vending machine should be operated
Simultaneous running of checkpoints for all 50 CDEs
Try to remove an item from the empty shopping basket
Power failure when an unsaved document is present in the
application- buffer related issue
Criticisms of Negative Testing
Negative testing can hurt the project by contributing to
delays and time waste
(should be done only when all your Positive test
executions are completed & you have time)
“But that would never happen in normal use”
“That’s an acceptable failure”
“Why find a problem we can’t fix?”
Side Effect occurs due to negative Test case: Long data in
the Textbox gives Fatal error or Java error (occurred in
our application)
Questions