- Slides: 12
Positive and negative testing • Positive testing tries to prove that a given product does what it is supposed to do. • When a test case verifies the requirements of the product with set of expected o/p, it is called Positive TC. • Example Lock and Key
“POSITIVE TESTING IS DONE TO VERIFY THE KNOWN TEST CONDITIONS”
Req No INPUT 1 INPUT 2 CURRENT STATE EXPECTED OUTPUT BR 01 KEY 09 Turn CW Unlocked Locked BR 02 KEY 09 Turn CW Locked NC BR 03 KEY 09 Turn ACW Unlocked NC BR 04 KEY 09 Turn ACW Locked Unlock BR 05 Hairpin Turn CW Locked No Change
• Consider the first row- Current state of lock is unlock and use key and turn it clockwise, the expected output is locked. • During execution the test results is locking, then the TC is passed. This is an example for “Positive test condition” for positive testing.
Consider the last row Current state of lock is locked. Using a hairpin and turn it CW should not cause a change in state or cause damage to the lock. After execution, there is no changes, then positive test case is passed. This is example of a “negative test condition” for positive testing.
Negative Testing • Negative Testing is done to show that the product does not fail when an unexpected input is given. • Negative testing covers scenarios for which the product is not designed and coded. • Test conditions termed as Unknown condition. • A negative test would be a product not delivering an error when it should or delivering an error when it should not.
Negative Test Cases INPUT 1 INPUT 2 CURRENT STATE EXPECTED OUTPUT Some other lock’s key Turn CW Lock Some other lock’s key Turn ACW Unlock Thin piece of wire Turn ACW Unlock Lock Hit with a stone
• In the above table, there are no requirement numbers. • Since negative testing focuses on test conditions that lie outside the specification. • Here all the test conditions are outside the specification, they cannot be categorized as positive and negative test conditions.
Difference- PT & NT Differ by their coverage • For PT if all documented requirements and test conditions are covered, then coverage is 100%. • If specifications are very clear- coverage can be achieved. Negative Testing 100 percentage coverage is not possible. Negative testing requires high degree of creativity. NEGATIVE TESTING IS DONE TO BREAK THE PRODUCT WITH UNKNOWNS