Exhaustive testing of all possible input is impossible in case of Data Driven Testing (DDT) as it is extremely difficult and time consuming to do and not to mention almost impossible to find out all possible testing scenarios. To overcome this situation, we need to partition the class of all possible inputs to try to simulate exhaustive testing. This partitioning technique is known as equivalence partitioning where all possible inputs are divided into equivalence classes. A test with one member of an equivalence class will be the same as a test with all the members of that class. This article will try to explain Equivalence Partitioning through the example of Hello World application.
1. Equivalence Partitioning in Software Testing through “Hello World”
Program
Md. Shamsur Rahim
Software Quality Assurance Engineer, Dhaka
Bangladesh
Prologue:
Exhaustive testing of all possible input is impossible in case of Data Driven Testing (DDT) as it is
extremely difficult and time consuming to do and not to mention almost impossible to find out all
possible testing scenarios. To overcome this situation, we need to partition the class of all possible
inputs to try to simulate exhaustive testing. This partitioning technique is known as equivalence
partitioning where all possible inputs are divided into equivalence classes. A test with one member
of an equivalence class will be the same as a test with all the members of that class. This article
will try to explain Equivalence Partitioning through the example of Hello World application.
Equivalent Partitioning for “Hello World”:
As per as Client’s requirement [1], the “Hello World” app is ready for testing. Let’s assume you
have performed all the testing except the testing of possible inputs. Before driving into further
discussion, let’s first at look the developed app.
As we can see, there is line “Press any key to continue . . .” which means we have to quit the app
by pressing any key from the keyboard. And here is the dilemma, to assure the proper quality we
should check the app by pressing every key but there are 101-keys in the US traditional keyboards
and 104-keys in Windows keyboards. Obviously pressing 101 or 104 keys is not a good idea. To
solve this problem we can think of equivalence partitioning. Before deriving partitioning classes,
let’s first observe the key types of a keyboard.
2. From the image, we can see that there are 8types of key in a keyboard. Namely:
1. Character keys
2. Modifier keys
3. Enter and Editing keys
4. System and GUI keys
5. Navigation keys
6. Function keys
7. Numeric keypad keys
8. Lock keys.
From the above mentioned types of key we can easily derive 8 equivalent partitioning input classes.
Then we can perform our testing by taking each input from each input classes. Thus we can cover
the testing for 101 or 104 keys by pressing only 8 keys. Because we have mentioned earlier that:
“A test with one member of an equivalence class will be the same as a test with all the members
of that class” and this is the magic of Equivalence Partitioning. As you haven’t test your “Hello
World” app by pressing all the keys, so now it’s high time to test it by pressing 8 keys only. If any
key is found which is not working then maybe it’s time to change the text!!!
Previous Article: Thinking Like a Tester: Is There Any Bug at “Hello World”
Program?