DECISION TABLE Testing tutorial with examples | Software and Testing Training


Hello everyone. This video is on Decision Table Testing. In this video, we will see what is the decision table and we will see decision table example with True or False values. Then we will see another example of decision table with multiple values. And then, we will see also the process of simplifying the decision table. So, let us get started. What is a decision table? Well, it is a way to document logic, especially complicated logic. So we do not miss any combination of the different input conditions. It also helps us in testing all combinations of the possible conditions. Now, a decision table contains two parts. One part is the Conditions (the different values we can give) and then there are the corresponding Actions. So with this, let us see an example of a decision table. All of us use the email applications, so when we try to open our email, there are two things we have to specify – the email and the password. So, let us see how we can build a decision table for testing email and password. So, a decision table is really a table. It contains all possible conditions and the corresponding actions. So here there are two conditions, Email and Password. The Email value can be False or True. Meaning Email is specified or not specified. Similarly, Password can be False or True. False meaning Password is not given. True means Password is given. So, one combination is we do not give the Email and we do not give the Password. So, both are False. So here, the system gives an error, “Please enter email” There is another possibility. We do give the Email, but do not give the Password. So Email is True, Password is False. We get the error, “Please enter the Password”. Another possibility is we don’t give the Email, but we give the Password. And here, the error is “Please enter the email”. And finally, the possibility is that we give both the Email and the Password. And depending on whether valid or invalid Email and Password has been given, login process will take place. So here, there are 4 possible condition entries over here. So at the top, we have the conditions. So Email condition, Password condition and Actions. There is a single Action, which is the Expected Result. And this Expected Result is whether we get an error or the login is processed. OK. Now, exactly the same decision table, but how do we arrive at number of different condition combinations? So here, we can see that the number of combinations is number of condition1 values and number of condition2 values. So, how many possible values are there for condition1, Email? We can give False or True. So that means two values for condition1. For condition2, there are also two values. We can give the Password or not give the Password. So, it is 2 * 2 is 4 combinations are possible for the conditions. So, we have to list each one of them in the decision table and write the corresponding action. Now, another way to find out the number of combinations is that… If each of the conditions is True or False, Or Yes or No, then we can find out 2 raised to power number of conditions. So here it is 2 raised to power 2, which is 4. Now, this is a bigger decision table again for the Email example. But here, what we can see is we have chosen 3 values for the Email and 3 values for the Password. So, the Email can be Blank, It can be Invalid or it can be Valid. And the Password can also be Blank or the password can be Invalid or the Password can be Valid. So here, there are going to be multiple combinations. Now how we start writing the decision table is first of all, multiply the number of possible Email values, so there is Blank, Invalid and Valid. So that is 3 values for Email. And password is also 3 values Blank, Invalid and Valid. 3 * 3 is 9. So, there are going to be 9 columns in the decision table. Then we have to write out each and every combination. So how we do it is, we write Blank for the Email 3 times because the Password has to iterate for every value. So, for Email as blank, we can give the Password as Blank or Invalid or Valid. Then we come to Invalid value for Email. And again, we repeat the Password values Blank, Invalid and Valid. Then, we come to the Valid value for Email. And again, repeat the Password values Blank, Invalid and Valid. Now here, we can see if the Email is Blank and the Password is Blank, there are couple of actions given over here for each condition combination. So, if the Email is Blank and the Password is Blank, it will give an error, “Please enter the email” and show us a login page. So that these are the two actions. Similarly, if Email is Blank but Password is Invalid, it will say “Please enter the email” and show us the login page. If the Email is Blank and the Password is Valid, still it does not matter. It will say “Please enter the email” and shows the login page. And like that, we can see each and every combination. And here, let us see if the Email is Valid and the Password is Invalid, then it is actually going to process the Email and the Password and login is going to fail. Because the Password is invalid and it will again show us the login page. Only when the Email is Valid and the Password is Valid, there is going to be no error message. And it is going to show us the home page. So I said before, number of combinations is number of condition1 values (so Email can be Blank, Invalid or Valid so that is 3 values). Number of condition2 values for the Password: again, it can be Blank, Invalid or Valid. So again, 3 values. So, total number of combinations 3 * 3 is 9 over here. Let us go to another example to see another decision table. So this is example of a library. Let us say, a user goes to the library and he or she wants to borrow a book. So, the Library Management System has 3 conditions that it checks. First of all, it checks whether the user is registered or not. If the user is registered, only then it checks If there is any outstanding fees or not? And if there is no outstanding fees, then it checks whether the user is under the borrow limit? So let us say, the borrow limit is 5 books and they already have borrowed 5 books. They cannot borrow another book. They have to return one of the existing books. But if they have borrowed 2 books and the limit is 5 books, then they can borrow another book. So here for User registered, there are only 2 possible values. So, either it is user is registered or not registered. So it is False or True. No outstanding fees: again 2 possible values are there, False or True. False means there is outstanding fees. True means there is no problem (no outstanding fees is there). Then Under borrow limit: again, 2 possible values are there, False or True. So True means they are under the borrow limit. And False means they have exceeded the borrow limit. So here, we can see if user is not registered and they do not have outstanding fees, and they are not under the borrow limit, then they are not going to be able to borrow the book. So, another example in this decision table is that if the user is registered, and they have no outstanding fees, and they are under the borrow limit then yes, they can borrow a book. Now, how this decision table has been created is User registered has 2 possible values False and True. So what we do is we find out the total number of combinations. So 2 possible values for User registered, 2 possible values for No outstanding fees and 2 possible values for Under borrow limit. So, 2 * 2 * 2, which is 8. So, there are going to be 8 condition combinations. So we have to put 8 columns: 1, 2, 3, 4, 5, 6, 7, 8. So, what we do is we keep on repeating False 4 times for User registered. Then repeat True 4 times for User registered. Then for No outstanding fees, we repeat False 2 times, True 2 times, False 2 times, True 2 times. And for Under borrow limit, we put False, True, False, True, False, True, and False, True. So this way, we can arrive at all possible combinations. So here, the total number of combinations is number of condition1 values, which is 2 for User registered, number of condition2 values No outstanding fees, again 2 possible values and number of condition3 values, which is Under the borrow limit again, 2 values. So in total, number of combinations is 2 * 2 * 2, which is 8. So this is how we build the decision table. Now, this decision table, it is possible to simplify it. So let us see how we can simplify this decision table? Now how we simplify the decision table is we find out the adjacent columns in the decision table, which have the same action. So here, we can see that both these columns have the action of No (No, the user cannot borrow the book). And what is the change here? There has to be just one change. Now, User registered is False in both cases. So there is no change. No outstanding fees is False in both cases, so there is no change. But here, Under the borrow limit, there is a change. It is False or True. So what this really means is, it does not matter if the user is under the borrow limit or not. They cannot borrow the book because they are not registered. And obviously, if they are not registered then outstanding fees also does not matter. So what we can do is we can combine these two columns into one. So, User registered is False. No outstanding fees is False and Under borrow limit can be False or True. So, we have combined two columns into one over here. So, User registered was False, No outstanding fees is False but Under borrow limit is now represented by a hyphen, which means Do Not Care. It can be True or it can be False. It really does not matter, the action is the same. Now, we can simplify this decision table further. So again, we have to look for a couple of condition combinations, where the action is same. So in these two, the action is same. And there is just one change. User registered is False in both these condition combinations. No outstanding fees is True and Under borrow limit can be False or True. It does not really matter. If the user is not registered, and there is no outstanding fees, then it does not really matter whether they are under the borrow limit. So we can combine these two columns into one. So, these two columns have been combined. User registered is False. Not outstanding fees is True. Under borrow limit is Do Not Care. And they cannot borrow the book because the user is not registered. Then we can continue the simplification. Now, let us look at these two columns. So, User registered is True, No outstanding fees is False and Under borrow limit can be False or True, still the action is the same. So we can combine these two columns into one. So, User registered is True, No outstanding fees is False, And they cannot borrow the book because they have a outstanding fees problem. Now, we can look at these two columns. The action is the same. And User registered is False and No outstanding fees does not matter. It can be False or True. Because the user is not registered. So we can combine these two columns into one. So here, we get this user is not registered, so outstanding fees does not matter. It can be True or False. Under borrow limit can be True or False whatever, but they cannot borrow the book. So this is how we simplify the decision table. Earlier if you remember, this decision table had 2 * 2 * 2 that is 8 columns, but we minimized the number of columns to 4. So now only 4 possible condition combinations are there. So this is very simple to understand also. In fact, many requirements… Complicated logic in the requirements is documented in the form of decision tables like this. And also, it is very useful for us in testing because we don’t forget to test any combination of the conditions. So here, what we have to test is we have to test that user is not registered, and we can give any value True or False for outstanding fees or under borrow limit and the system should not allow the user to borrow a book. Then we have to test the user is registered, but they have an outstanding fees problem. And does not matter whether they are under the borrow limit or not. They should not be allowed to borrow a book. Then we have to test that for a registered user, they do not have any outstanding fees problem. But they are not under the borrow limit. That means they have exceeded the borrow limit. The system should not allow the user to borrow the book. Then we have to test for the user is registered. They do not have any outstanding fees problem. And they are under the borrow limit and the system should allow the user to borrow the book. So in this video, we have seen what is the decision table. A decision table is a table of all possible conditions and corresponding actions. Then we saw an example of a decision table with True or False values. Then we saw an example of decision table with multiple values in the Email and Password. Then we also saw how to simplify the decision table. So I hope this video was helpful to you, and thank you very much.

Leave a Reply

Your email address will not be published. Required fields are marked *