One of the most fundamental enablers of agile ways of working is the ability to swiftly and reliably detect problems in your product - that is, to test it efficiently and effectively. Unfortunately, the "traditional" approach of black-box testing a running application is hardly useful for this purpose.
I have created an executable use case to illustrate the problem.
Let's take a look at this little service, and assume that it would be your responsibility to test it in a way that you can reliably tell whether it works correctly, or which problems it has:
You can call this service in the mini applet included on this page if you have JavaScript enabled..
Alea iacta est
You need Javascript to run this demo.
|
Yes, just try it out - roll the dice!
That's about as simple as an application can get.
Can you imagine how much effort it takes to properly test this simple application?
Hello
You need Javascript to run this demo.
|
What if I told you that this is a call to the same service?
Yes, exactly - you didn't know everything the service does when you created your test concept before.
There's a different feature hidden in the service: if you pass a user name to the request, it will greet you!
You lose!
You need Javascript to run this demo.
|
Did you even catch that this one behaves different?
What if I told you that this is another call to the same service?
Yes, exactly - you still didn't know everything the service does when you created your test concept.
There's another different feature hidden in the service: you can load the dice and cheat!
So, now you need to run your entire test set from above twice again - with and without cheating.
And we haven't even looked into whether there are multiple ways of cheating, or whether the cheating function always triggers correctly when the variable is set (hint: it doesn't). Good luck without knowing the application where the malfunction is.
But we're not done yet:
I win
You need Javascript to run this demo.
|
Did you catch the difference here?
By now, you're probably doubting whether you understood the application at all when you started testing it.
The code
Now - let me blow your mind and tell you how little source code was required to totally blow your test complexity and effort out of proportion:That's it. This little snippet of code is entirely sufficient to keep a Black Box tester busy for hours, potentially days, and still remain unable to make a reliable statement on whether they missed anything, and which problems the product may or may not have.
Depending on how your application is designed, a few minutes of development effort can generate a humongous mountain of effort in testing.
Thanks for sharing Michael. A sound collaboration between developers and testers is needed especially when application grow more complicated than your example. Most applications have more than 6 lines of code I believe :)
ReplyDeleteYes, absolutely.
DeleteThis example is an extremely simple demonstration how fast code can become problematic. It goes downhill from here as an application grows in complexity.
How would you rewrite this code to make it more testable then?
ReplyDeleteWait for it ... a post on that will come soon :)
Delete