What is Scriptless Test Automation and how can we use TestProject to do this? In the previous blog https://icehousecorp.com/automation-testing-and-how-to-start/, we discussed how test automation could significantly benefit the testing process. This time, I will explain one of the test automation methods, a scriptless test automation which will be helpful for software tester who does not […]
Decision Table Testing, State Transition & Error Guessing
Improve your test case coverage by using this test design technique
Decision Table Testing, State Transition & Error Guessing can be very powerful in increasing your test design coverage. Continuing from the previous blog about test design techniques: Equivalence Partitioning and Boundary Value Analysis, in this post, I will explain other design techniques that are commonly used in software testing:
- Decision Table Testing
- State Transition Testing
- Error Guessing
Decision Table Testing
What is a Decision Table
The decision Table technique is one of the BlackBox test design techniques in software testing. This technique is used when there are different combinations of input for the test conditions which will have different outcomes for each combination of test inputs. Usually, this Decision table testing is used when there are complex business rules to be tested and using this technique will help to identify the correct test cases to be tested. Generally, it is applied when the specification requirements or business rules are in the form of tables or flow charts.
Why is the Decision table commonly used in Software testing? Because the main and the most important objective of Decision table testing is to ensure 100% test coverage without missing any possible relation between the input combinations and the expected outcome from each input. Besides covering the possibilities from all specification requirements relation, the Software QA is also required to consider if any boundary values check to exist between each rule while creating the decision table.
Below are the guidelines on how you could design the Decision Table:
Guidelines for Decision Table Testing
Given the requirements below as the example for designing the decision table:
Transfer money is successful when the user enters the valid beneficiary account, and also the amount is sufficient with the correct OTP entered for the verification.
The workflow is as follows:
These are the steps on how you could design the decision table based on the requirements above:
Step #1 – Analyze the requirement and create the first column
Based on the requirements above, to analyze the requirement, you could define the conditions and the corresponding actions. In the case above, there are 3 conditions and also 3 actions. We can create the first column with the conditions and actions accordingly:
|Is the account approved?|
|Block the transaction|
|Show message as “Insufficient Amount”|
Step #2 – Add Columns
Once the first column is created, now you could add more columns which indicate the combination of input and outcomes. The number of columns that are required to be added to the decision table depends on the number of conditions and the number of actions of each condition. If there are two conditions and each condition can be either true or false, then the tester needs to add 4 columns. Based on the requirements in step #1, we have 3 conditions, hence there will be 8 columns.
Mathematically, the number of columns is 2conditions. In this case, 23 = 8 columns.
Once the columns are defined, you could then start to add the True and False values on each condition for the actions, refer to the flow chart in the requirements section and you will place the check mark on each action against the combinations of each condition. You may put (-) when the input doesn’t have the outcome accordingly as this column will be removed in the next step. Refer to the column below for the example:
|Account is Approved?||T||T||T||T||F||F||F||F|
|Sufficient amount balance?||T||F||T||F||T||F||T||F|
|Block the transaction||✓||✓||–||–||–||–|
|Show message as “Insufficient Amount”||✓||–||–||–||–|
Step 3 – Reduce the table
As mentioned in the step #2, for the columns which have invalid combinations or that are identical, you can delete them. Invalid combinations are those that cannot happen. For example, in the case above from TC5-TC8 when the Account is not approved, there are no other actions at the bottom that will happen. The TC 5 is considered an invalid test case, but we could keep this column as a negative test case. The columns TC6-8 are identical to TC5, so we could remove these.
The column will be as follows:
|Account is Approved?||T||T||T||T||F|
|Sufficient amount balance?||T||F||T||F||T|
|Block the transaction||✓||✓||–|
|Show message as “Insufficient Amount”||✓||–|
Step 4 – Write Test Cases
Once the table is designed, you can write the test cases based on the table from step #3. At least one test case per column gives full coverage of all business rules.
Examples of the test cases that you could write are:
|TC1||Verify that the user is able to transfer money when the account is approved, otp is matched and the amount balance is sufficient.|
|TC2||Verify that the system will display the message “Insufficient Amount” when the user is trying to transfer with an insufficient balance|
|TC3||Verify that the system will block the transfer process when the user is trying to transfer money with the OTP that does not match.|
|TC4||Verify that the system will block the transfer of money when the user is trying to transfer money with the OTP that does not match and the amount balance is insufficient.|
|TC5||Verify that the user is not able to transfer money when the Account is not Approved.|
Advantages and Disadvantages of Decision Table Test Design Technique
|Advantages of Decision Table Testing||Disadvantages of Decision Table Testing|
|The Decision table could help to make effective combinations and will be able to ensure better coverage for testing.||Decision tables only present a partial solution|
|Simple to understand and everyone can use this method to design the test scenarios and test cases.||The decision table does not depict the flow of logic of a solution|
|Any complex business flow can be easily converted into test scenarios and test cases.||Decision tables are quite far away from high-level languages.|
What is State Transition
State Transition is also one of the black box testing techniques. Different from the Decision table technique, in this state transition technique the outcomes are triggered by the changes to the input conditions or changes to the “state” of the system. The state transition technique is usually used when the system is defined as the number of states and the transition between the states is provided by the rules of the systems.
There are two main ways to represent or design the state transition, which are using the State transition diagram and state transition table. I will explain more about the State Transition Diagram and State Transition Table with their differences and examples below:
State Transition Diagram and State Transition Table
State Transition Diagram shows how the state of the system changes on certain inputs. In this diagram, there are four main components:
- States – State is a distinguishable situation of a system. A system can only be in one state at any point in time. A system can transition from one state to another.
- Transition – A Transition is a change from one state to another. A transition may also be to the same state (a “transition-to-self”)
- Events – An event in an occurrence inside or outside a system that can result in a transition.
- Actions – An action is behaviour executed at a particular point in the system. It can also be a string of actions.
In the state transition diagram, the states are shown in boxed texts, and the transition is represented by arrows. It is useful in identifying valid transitions. Refer to the image below on how the state transitions diagram sample:
In the State Transition Table, all the states are listed on the left side and the events are described on the top. Each cell in the table represents the state of the system after an event has occurred.
|State\Events||Event 1||Event 2||Event 3|
Guidelines for State Transition testing
Consider an online banking system where if the users enter invalid OTP 3 times the account will be blocked
In this system, if the user enters a valid OTP in any of the first three attempts the user will be able to transfer the money successfully. If the user enters the invalid OTP for the first or second try, the user will be asked to re-enter the OTP. But if the user enters an incorrect OTP on the third try, the account will be blocked.
The diagram below shows that how the money transferring process using OTP:
Step #1 Create the Transition table from the diagram transition
In the transition table, list out the State transition as a row, and the event as a column.
|State||Valid OTP||Invalid OTP|
|S1 – Enter OTP||S5||S2|
|S2 – 1st Try||S5||S3|
|S3 – 2nd Try||S5||S4|
|S4 – 3rd Try||S5||S6|
|S5 – Money Transferred Successfully||–||–|
|S6 – Account Blocked||–||–|
The value of each event is where the transition of each state against the event. From the table, when the user enters the valid OTP, the state is transitioned to S5 which is Money Transferred successfully. If the user enters an invalid OTP, then the next transition is to S2 which is 1st Try. If the user does the same up until the 3rd time, then the user will reach the state S6 which is the Account blocked state.
Step #2 Write Test Cases
Once the transition table is designed, you can write the test cases based on the transition table from step #1. At least one test case per column gives full coverage of all business rules.
Examples of the test cases that you could write are:
|TC1||Verify the money is transferred successfully when the user enters the valid OTP|
|TC2||Verify the money is transferred successfully when the user enters the valid OTP after the first try entering an invalid OTP|
|TC3||Verify the money is transferred successfully when the user enters the valid OTP after the 2nd try entering an invalid OTP|
|TC4||Verify the money is transferred successfully when the user enters the valid OTP after the 3rd try entering an invalid OTP|
|TC5||Verify the user is able to reenter the OTP again after entering the invalid OTP for the first try|
|TC6||Verify the user is able to reenter the OTP again after entering the invalid OTP for the 2nd try|
|TC7||Verify that the account is blocked when the user enters an invalid OTP for the 3rd time.|
Advantages and Disadvantages of State Transition Test Design Technique
|Advantages of State Transition Testing||Disadvantages of State Transition Testing|
|By using the state transition table, the tester is able to see the full coverage of test cases as the conditions are covered.||With this technique, the tester needs to define all possible states of a system. This will not be a problem when the requirement is small, but when it comes to a more complex system, this technique will not be efficient to use as there is an exponential progression in the number of states.|
|Using this technique gives a proper representation of the system’s behaviour.||When using this state transition testing, the tester can’t always rely on this technique. For example, if the system is not in sequential order or not in a finite system, this technique can’t be used.|
What is Error Guessing?
In software testing, Error Guessing is another black-box testing technique which is experience-based. Because of this, it requires skilled and experienced testers as they can use their experiences to guess the common problematic areas of the application.
This technique does not follow any specific rules. So the scope of the test cases depends on the kind of testing the tester has been involved in. This Error Guessing technique can be used at any level of testing. The following are the common mistakes that an experienced tester will check during the error guessing testing:
- Entering an invalid data type on the fields (e.g entering an integer in the field that only accepts a string data type)
- Pressing the submit button without entering the value on the mandatory fields
- Uploading the files when exceeding the maximum limits or different file types from what it’s accepted
- Entering invalid parameters
The following factors can be used to guess the errors:
- Lessons learned from the previous release
- The tester’s intuition and experiences
- Previous defects that have been found
- Production issues reported by the customer
- Application UI
- Variety of data used for testing
Guidelines for Error Guessing
Since the Error Guessing technique is an experience-based test, it is difficult to give a well-defined guideline for this technique. However, you could learn about how you could perform the error guessing technique and also improve your analytical thinking:
- Gain knowledge of technical understanding – Do not only rely on what errors will happen on the application but have a better understanding of the technical side such as: how the code is written, the concepts of the array, indexes, boundaries, loop, etc are implemented in the code. Besides, you could also learn about the technical environment such as server, operating system and database. This will help you to gain more experience in the Error guessing technique.
- Understand what kind of errors tend to be made – An experienced tester would know what types of errors tend to occur in the past. e.g On the payment billing system application where the tax calculation logic has often failed with the application with different tax rules. In such cases, the tester will try different kinds of combinations between changing the tax rules with the invalid and valid data and see if the logic is still working fine.
Example of Error Guessing Technique:
There is a requirement to the “register a new account” feature where it states that the password should consist of 8 characters minimum with the combinations of lower case, upper case, special characters and numbers, and this Password field is mandatory.
Based on the requirement above, these are the Error guessing techniques you can use:
- What will be the result if the Password field is left blank?
- What will be the result if only lowercase characters are entered in the Password field?
- What will be the result if the combination of values entered is less than 8 characters?
- What will be the result if the combination of values entered is more than 8 characters?
- What will be the result if the value is entered only numeric?
Besides the sample of the error guessing mentioned above, you could still produce other scenarios based on your experience with how you test an application.
Advantages and Disadvantages of the Error Guessing Technique
|Advantages of the Error Guessing Technique||Disadvantages of the Error Guessing Technique|
|By using this technique, it is very helpful to guess problematic areas of the application.||This technique is only able to be performed by experienced testers. The focal shortcoming of this technique is that a person is dependent.|
|By using this technique, you could help to uncover the defects that couldn’t be found through formal testing.|
- The Decision Table technique is used when there are different combinations of the input for the test conditions which will have different outcomes for each combination of test inputs.
- There are two main ways to represent or design the test cases using the State Transition test design technique, State Transition Diagram and State Transition Table
- The difference between the State Transition technique from the Decision table technique, in this state transition technique the outcomes are triggered by the changes to the input conditions or changes to the “state” of the system
- The Error Guessing technique does not follow any specific rules. So the scope of the test cases depends on what kind of testing the tester was involved in the past.
Showing responses for
Test Automation with Katalon: Optimize Script Reusability By Using a Custom Keyword
How You Can Use Custom Keywords via Katalon To Improve Test Automation Most applications nowadays are made up of several repeated steps in their navigation. These repeated steps may cause some toil in Automation testing as we are required to write or record the steps all over again. Another case would be automating the required […]
Test Automation with Robot Framework: Page Object Model & Best Practices
Automate Your Testing Process Using Robot Framework If you are a manual Quality Assurance and currently considering learning about automation testing out of curiosity or necessity, this article might be helpful in your exploration of automated testing tools. To start, you should read about automation testing. You can implement this into your testing process by […]