Test Design Techniques
-
Test Design Techniques are structured methods used to derive and create test cases to ensure that a software system is tested effectively. These techniques help testers select the right test conditions, design the test cases, and ensure thorough coverage of the application under test.
-
They are often categorized into three main types: Black-box techniques, White-box techniques, and Experience-based techniques. Below is a breakdown of these categories and the popular techniques within each.
Black-box Test Design Techniques
- These techniques focus on testing the external behavior of the software without knowledge of the internal code or implementation. Testers are only concerned with the input-output relationships.
Equivalence Partitioning (EP)
- Definition
- Purpose
- Example
- This technique divides input data into partitions or classes. It assumes that all values within a partition behave similarly, so only one value from each partition needs to be tested.
- Reduce the number of test cases while still providing adequate test coverage.
If an input field accepts numbers between 1 and 100, you can divide the input into three partitions:
Valid partition: 1 – 100
Invalid partition: < 1
Invalid partition: > 100
Boundary Value Analysis (BVA)
- Definition
- Purpose
- Example
- This technique focuses on testing the boundary values of input ranges, as errors tend to occur at the edges of input ranges.
- Catch errors at the boundaries of input values.
For a field that accepts numbers between 1 and 100, test cases should include values at:
1 (lower boundary)
100 (upper boundary)
0 (just below lower boundary)
101 (just above upper boundary)
Decision Table Testing
- Definition
- Purpose
- Example
- A decision table helps model complex business rules or combinations of inputs to determine corresponding actions or outputs. Each combination of inputs is considered a unique test case.
- Ensure comprehensive coverage of business rules by testing all combinations of inputs and actions.
- For a loan approval system, the decision table could define rules based on criteria like credit score and income level, where different combinations lead to approval, denial, or conditional acceptance.
State Transition Testing
- Definition
- Purpose
- Example
- This technique is used to test systems where different inputs or events cause the system to change its state. Each state and transition between states is tested.
- Test how the system behaves when transitioning from one state to another.
- A user account can be in different states such as "Active," "Suspended," or "Closed," and inputs like "Login" or "Payment" trigger transitions between these states.
Use Case Testing
- Definition
- Purpose
- Example
Definition: This technique tests the system based on use cases, which are real-world scenarios or user interactions. Each use case defines a sequence of steps between a user and the system.
Example: For an e-commerce website, a use case might involve a user searching for a product, adding it to the cart, and completing the purchase.
Purpose: Validate that the system behaves as expected in real-world use cases.
White-box Test Design Techniques
- These techniques involve knowledge of the internal code structure and are used to design tests that explore the internal workings of the system. They focus on covering the code comprehensively.
Statement Coverage
- Definition
- Purpose
- Example
- This technique ensures that every executable statement in the code is executed at least once during testing.
- Provide a basic level of test coverage by ensuring that no statements in the code are missed.
- If a piece of code contains 10 statements, a minimum of 10 test cases should be created to execute each statement at least once.
Decision (Branch) Coverage
- Definition
- Purpose
- Example
- This technique ensures that every possible branch (true / false) of each decision point in the code is executed at least once.
- Ensure that all branches in the code logic are tested, helping to catch bugs that occur in specific decision paths.
- For an if condition in the code, both the true and false outcomes should be tested.
Condition Coverage
- Definition
- Purpose
- Example
- This technique ensures that every condition within a decision statement is tested. ie: A part of a decision that evaluates to true or false.
- Test each condition independently to ensure that all conditions within a decision statement are evaluated.
- In a compound condition like if (A && B), condition coverage ensures that both A and B are tested for true and false values.
Path Coverage
- Definition
- Purpose
- Example
- Path coverage ensures that all possible paths through the code are tested, from start to finish.
- Provide comprehensive coverage of the control flow by testing all possible paths through the code.
-If a program has two branches, there are four possible paths through the code, and all four should be tested.
Experience-based Test Design Techniques
- These techniques rely on the experience and intuition of the tester to identify areas of the software where defects are likely to occur.
Error Guessing
- Definition
- Purpose
- Example
- This technique is based on the tester’s experience and intuition to guess where defects might exist in the application and design test cases accordingly.
- Identify common errors that may not be covered by other formal test techniques.
- A tester might suspect that the application may fail to handle null values, so they design test cases to input null data and check the system’s response.
Exploratory Testing
- Definition
- Purpose
- Example
- In exploratory testing, test cases are not predefined. Instead, the tester explores the application, simultaneously learning about it and designing and executing tests on the fly.
- Discover defects that may not have been anticipated in the test design phase.
- While using a new feature of a mobile app, a tester might interact with various parts of the feature to see if any unexpected behavior occurs.
Checklist-based Testing
- Definition
- Purpose
- Example
- This technique uses a checklist of test conditions, based on experience, guidelines, or previous test efforts. The tester ensures that all items on the checklist are tested.
- Provide a quick reference to ensure all important areas are covered during testing.
- A checklist for web applications might include testing for responsiveness, cross-browser compatibility, and error messages.
Summary of Test Design Techniques
Black-box Techniques
- Definition
- Techniques
- Focus on inputs and outputs without knowing the internal code.
- Equivalence Partitioning, Boundary Value Analysis, Decision Table Testing, State Transition Testing, and Use Case Testing.
White-box Techniques
- Definition
- Techniques
- Focus on internal code structure and coverage.
- Statement Coverage, Branch Coverage, Condition Coverage, and Path Coverage.
Experience-based Techniques
- Definition
- Techniques
- Rely on tester’s intuition and experience.
- Error Guessing, Exploratory Testing, and Checklist-based Testing.