07 November 2010

Testing is Fun and Brain Intensive - Why

Why testing is fun and Why testing has to be brain intensive

Before answering it, let us do this exercise.

Let us take one of the primitive types - "int" in Java and an arithmetic operation addition (imagine that you are testing Java compiler that will be used by developers/testers worldwide). What are things that you would do to verify the correctness of addition for "int". For now, let us focus only on integer addition alone. List down the things that you will learn (meaning that you should know) for completing the task. This exercise will help us to know "why testing is fun, why it has to be brain intensive and why it is equally rewarding".

To help you with some code, this is how addition looks like and you got to test + (which is in red font)

int a = 10, b = 255, c;
c = a + b;

How will you proceed?

4 comments:

Kiruba said...

I need to know,
1.What is a int number mean,
its range from -ve to +ve (4 bytes, signed - two's complement)
2.How addition (+) works
3.What result the int addition will yield if we pass fractional nos as as argument.
4.We also need to know how fractional nos are handled in integer addition.
5.If the result of adding the 2 integers exceeds the max range, how this is handled. (Assuming result also stored in int)

I could guess only these as of now :)

Lakshmi said...

@Kiruba

cool insights again.

will wait for more insights.

Unknown said...

Start from Basic:
Positive cases:
Operands allowed. Since you mentioned only integers,
+ve or -ve
The range for integer.

Result
Range of Result.

Advanced:
Priority in case if operator used multiple times.
Operations executed from left to right or right to left?
Whether overloading is allowed? Other data type passed what happens?
If result is exceeded the maximum or minimum range?
Whether operand can be only integers or it can complex say.. + can take operand a (or) b , a and b can be combination of other arithmetical operations.
Default values for integer, whether the variable should be initialized?



Still advanced:(Java thinking)
How additions are happening whether it's atomic operations? The result always same for same numbers? (Consider multithreading :-))

Microprocessor:

Memory requirements?
How many registers are available?
How shifting takes place, operations of stack?
Instruction set for the underlying multiprocessor? In otherwords, supported Microprocessors?

Let me stop here..The list goes on... May be I understood requirements wrongly?:-)

Lakshmi said...

@Guru

u r thinking like a computer scientist :-)

Awesome... keep going..