5 Test Case Design Techniques I Use To Write Smarter Test Cases

Updated: Mar 23


Test case design techniques
Test case design techniques

Importance Of Test Design Phase


I see software testing as a four-phased activity that runs across the application development. Even with the Agile development methodology, we can implement testing in these four phases, these are -

  1. Test Planning,

  2. Test Design,

  3. Test Execution & Reporting, and

  4. Defect Management.

I have seen that out of all the software life-cycle development phases, software teams give the least importance to the ‘test design’ phase. In spite of the fact that this phase is the most critical for the quality of the software applications, teams struggle to give this phase its due attention. The importance of this phase can be understood as this phase lays the foundation of the testing and ensures the testing journey remains effective, consistent, and repeatable. Even in the Agile software development methodology where the ask is to complete the testing within the sprint, the importance of test planning and designing can not be undermined. As we all know that exhaustive testing is not possible, a properly planned test design phase will ensure maximum testing coverage with minimum test conditions and efforts.



Why use Test Case Design Techniques?


The intention of the ‘test design’ phase is to produce test scenarios and executable test cases that provide testing coverage and creates maximum chances to find defects when executed in the ‘test execution’ phase. Hence, it is imperative that the test cases are well-designed, easy to understand, and most importantly, provide 100% functional coverage so that defects are not leaked to higher environments. This is why rather than creating test cases at random, I use the test case design techniques to create and review test cases. It provides a methodological way to approach test case creation. A randomly designed test case suite will lack quality and coverage, which will lead to defect leakage. The best practice to avoid this situation is to have a dedicated test designing phase where test scenarios and test cases are prepared in advance by implementing test designing techniques.

For agile projects, this phase could be of very short duration, maybe lasting only for a few hours to days. Along with better-designed test cases, having a dedicated test design phase will also ensure the test execution phase can be planned more accurately in terms of the effort it will take for executing these test cases.

Don't just write test cases, design them for 100% coverage using proven techniques.

Learn - Difference between Test Scenarios & Test Cases



Five Test Case Design Techniques


Following are the important test case design techniques. Software testers should use these techniques judiciously and apply their understanding of which technique suits the scenario he/she is testing.




1. Boundary Value Analysis (BVA)


BVA is a technique based on testing the boundaries of the test data. It includes maximum, minimum, inside or outside boundaries, and error values. This technique is based on the likeliness that developers will make mistakes at the boundaries conditions. In essence, a number of errors occur at the boundaries rather than the center of the input domain. Its working principle is that if a system works for these particular boundary values then it will work for all values between two boundary values.


For eg.


Test scenario - A text field accepts input between 1 to 10


Test cases as per Boundary values analysis - 0,1,2 and 9,10,11



2. Equivalence Class Partitioning

Equivalence class partitioning is another technique used in black-box testing. This technique partitions the input domain into a number of classes or partitions. This is based on that software will behave in the same way for test data within the same classes. Hence testing for one input per class shall ensure coverage for all the other possible inputs in that class. Then the test cases are then designed for each class.


The working principle behind this technique is that the test case of a representative value of each class is the same as the test case value for any other input within the same class. It allows you to identify valid as well as invalid equivalence classes.


For eg.


Test scenario - A text field accepts input between 1 to 10


Test cases as per Equivalence class partitioning are -

There are three equivalence classes

  • infinity to 0 (invalid)

  • 1 to 10 (valid)

  • 11 to infinity(invalid)


Test cases from each class,

-2, 5, 15



3. Decision Table Based Testing


A decision table, also known as the cause-effect table, is a tool used for test case designing. It provides a tabular view of the inputs and expected outcomes to test how the system behaves for different input combinations. It provides a systemic way to write test conditions and provides better test coverage where input plays a role to define the outcome of the software.


Decision Table Testing is used for functions that respond to a combination of inputs or events.


For example, Let take a hypothetical example to build software that ensures only valid people should get the covid-19 vaccine.


Rule - 'Only people with age > 60 years or anyone above 45 years with either diabetics or hypertension history should be allowed vaccination'.


Now using the decision table technique. Following should be the test cases -

Decision Table Based Testing
Decision Table Based Testing

As you see from the above example, this technique is the easiest way to achieve 100% test coverage.


4. State Transition Testing


In this technique, the software is considered to have a finite number of states. The transition from one state or another of Application Under Test (AUT) happens in the responses to the action of the users.


This technique allows the tester to enter action bases input conditions and thereby, testing the behavior of the AUT. Both positive and negative input values are provided for the evaluation of the system behavior.


For example, Let take a simple example of an application with just a login functionality.


Rule - User (assuming an existing user) can only login with valid credentials and should get a welcome message. With invalid credentials, the user should get an error message.


Now using the state transition technique. Following would come as the state of the system.


State Transition Testing
State Transition Testing

This technique gives a representation and coverage of all possible application states. This representation can be then used to test the system.



5. Error Guessing Testing Technique


This technique is an experience-based technique. Its success depends majorly on the level of experience and knowledge that the test analyst has about software testing, the application’s functionality, and behavior. The tester anticipates the possible errors using their experience, knowledge of edge cases, and exception scenarios in the software flow.

The technique counts a list of possible errors or error-prone areas of the software. The tester writes the test cases for these conditions. Hence the tester can use past experience to design the test cases using this technique.



Conclusion


To ensure the success of the software testing process, it is highly important to understand the significance of designing good test cases. We have learned briefly about the five primary techniques used in designing efficient test cases. Identification and selection of the most appropriate test case design technique will prove to be beneficial for the tester, organizations, and the user.


Learn Advance - Software Testing Effort Estimation Techniques


5,165 views0 comments

Recent Posts

See All