Is there any value to positive testing? Some experts say No! I think there is--and here's why...
There is a school of thought in software testing that debunks the value of positive testing. This school basically states that any test that does not produce a defect is not a good test. I respectfully disagree.
Software tests can be divided into two categories: positive tests and negative tests. A positive test is used primarily, if not solely, to validate that a given system, function, operation, etc. works as designed when a user enters the right data, in the right place, at the right time, clicks the right buttons, etc. Negative tests try to purposely break the system to verify that the system responds as expected and fails gracefully when it gets the wrong data, in the wrong place, at the wrong time. It’s with negative tests that we really earn our stripes as testers. A negative test should cause an error. It's expected to cause an error. If it causes an error, and the error is handled correctly, the test passes. So to recap–a positive test should not cause an error. Does that make it an invalid test–absolutely not!
The ultimate goals of each of positive and negative tests are completely different. To my thinking–we need to verify that something works correctly before we try to break it. If we don't know that it works correctly, then how can we know when it doesn't? Positive tests answer that question. If the system doesn’t work as it’s supposed to when everything is correct, all other tests, especially negative tests, are really irrelevant.
Let me state right up front–I'm not a professional software developer–not even close. I never claimed to be one. But I'm no slouch either! Let's just say–I like to dabble. Given enough time and the right reference books, I can build a class, or a Web page, or whatever. From my limited experience, I like to make sure something works first, and then I focus on what happens when it doesn’t. It's also much easier to build. Call me crazy, but that just make sense to me.
Imagine my surprise when I was recently told that some negative functionality would be delivered before the positive functionality. I was perplexed! Surely, they could not be serious! They were. The results were predictable. I couldn't create and save a basic record but the error handling was really nice. In a nutshell, the system could not do what it was designed to do but it looked really good.
It reminds me of a car I bought in high school. It looked really nice in the driveway. It had to sit in the driveway–it rarely ran. But I washed and waxed it every weekend! It also had an awesome 8-track stereo system! I spent hours sitting in the driveway listening to my Led Zeppelin and Aerosmith 8-tracks. Life was good! I remember a friend once telling me that the car was over-rated and didn’t perform anywhere near they way it was rumored to perform. I just wanted it to start and take me to the store. How fast I got there was really irrelevant at this point. Apparently it also got really bad gas mileage. In the late 70’s, with gas prices hovering around 80 cents a gallon this was pretty important. Of course, sitting in my driveway it got great gas mileage!
Automotive magazines would advertise all kinds of devices to boost miles per gallon. Again, my "friends" would encourage me to purchase all of these gadgets. "They will pay for themselves after just a couple of tanks," they would say. I could care less. I just wanted the stupid