15 November 2010

Yes, Testing is Fun and Brain Intensive


Few days back, i wrote on the topic - "Testing is Fun and Brain Intensive - Why" giving a scenario. I was stumbled by the comments of Rajaguru and thought it had deeper/unusual meaning. Hence requested him to share his insights by expanding his comments. This post is just expanded version of his comments and hence the post will be little short (if you take this as a comment, then it is bit lengthy). Before reading this post, i would suggest you to read this and then come back here. From here on, the post contains insights shared by Rajaguru via his comments. BTW, this is the first guest post in Unstuck (a new thing). Looking forward for more guest posts with deeper insights.

@rajaguru - thank you for the new start :-)

Real Stuff & Insights by Rajaguru

When I saw @lnarasim tweeted the title ”Testing is Fun and Brain Intensive”, the immediate thought that came to my mind was "wasn't the testing boring one"? Because that's what we will discuss with other people. As a developer we think that testing is mundane and routine task. The more I thought about it, the clearer I was because I was testing (questioning) my thoughts! Leave the philosophy and let us get back to real stuff. Being a developer, designer or tester, testing is must, the more we test the more effective is our design, coding, system. Come on let’s test and find it!

In the post the problem states, test the following, assume you are testing compiler, and don’t go beyond the integer.

int a = 10, b = 255, c;
c = a + b;
Simple. Isn’t? The first test case comes to my mind is print the value of the variable "c" and check the answer is 265. Shall we consider the testing of “+” is over? Why not it produces the desired result. Let me stop and rethink, whether the testing over. Noo. (A big No... not big O J ).
I am testing the operator “+” for integer, when you say Operator, you need to test what are the possible operands it can take. Whether it takes +ve integer or –ve integer? If it’s +ve or –ve the range it takes?
The operand is over, what about the result? What it takes, when both the operand reaches the maximum value if result also same type, how it can be assigned the result? So, whether result should be stored in a data type that accepts higher range than the operands?
Whether now we covered all the test cases? Rethink, we are testing compiler, and operator “+”?  Now we will move one step further, how the addition can be implemented, using number of shift operations? Or move operations? Binary additions? Incase, what are the instructions it should use for implementing that? Whether, all machines support the same instruction set?
Where this value will be stored? Memory requirements to run this program? … Let me stop here. May be we can’t stop on some point saying all possible test cases are identified? Always we can add more, test more, and break the system, change the implementation and start the testing from the scratch.
We can conclude that Testing is really Fun and of course Brain Intensive too, when you want to get more understanding of the system, test the system until system is broken or you are broken :-)

About Rajaguru:
Software Engineer by profession, chatterbox to friends. He says he always searches something in Google, books, movies and life. Connect with him in Twitter, Facebook, LinkedIn. For those who want to see the "user interface" of Rajaguru to identify when you see him next time (to buy you food or movie ticket), here is his picture with a temple backdrop.