What is a Software Testing Technique? - Test design techniques
Software testing techniques help you design better test cases.
They also help reduce the number of test cases that need to be executed.
Boundary Value Analysis (BVA)
BVA is based on testing the boundary values of valid and invalid partitions.
It is a black-box software testing technique in which test cases are designed using boundary values.
To perform it:
- Start by selecting test cases that include values at the boundaries of the input domain.
- Determine the number of input variables in the problem.
- For each input variable, determine its range of values.
- Determine its extreme and nominal values.
For Each Variable, We Check
- Minimum value
- Just above the minimum
- Nominal value
- Just below the maximum value
- Maximum value
Focusing purely on boundaries, we typically consider six factors:
- Min
- Min + 1
- Min − 1
- Max
- Max + 1
- Max − 1
Equivalence Partitioning
A black-box testing technique in which we divide the input data into equivalent classes and take a value from each class as the test data.
It divides the input domain into data classes, and test cases are derived from these classes.
It reduces the number of test cases and saves testing time.
Guidelines for Equivalence Partitioning
- If a range condition is given as input, then one valid and two invalid equivalence classes are defined.
- If a specific value is given as input, then one valid and two invalid equivalence classes are defined.
- If a member of a set is given as input, then one valid and one invalid equivalence class are defined.
- If a Boolean is given as an input condition, then one valid and one invalid equivalence class are defined.
Decision Table Testing
A software testing technique used to test system behavior for different input combinations.
It is a systematic approach in which different input combinations and their corresponding system behavior (output) are captured in a table.
A decision table helps check all possible combinations of conditions, making it easy for testers to identify missed conditions.
The conditions are indicated as:
- True (T)
- False (F)
State Transition Testing
A black-box testing technique used to observe the system's behavior under different input conditions, tested in sequence.
Both positive and negative input values are provided, and the system's behavior is observed.
Example – ATM
You go to the ATM.
- On the first try, you enter the correct PIN and get access.
- If you then enter a wrong PIN, you don't get access.
- The same happens on the second and third tries.
- If you enter an invalid PIN three times in a row, your account gets blocked.
In this technique, we test the application with both valid and invalid inputs in sequence.
Cause-Effect Graphing
A technique in which a graph is used to represent the situations of combinations of input conditions.
The graph is then converted into a decision table to obtain the test cases.
It is used because Boundary Value Analysis and Equivalence Class Partitioning do not consider combinations of input conditions.
Error Guessing
A black-box testing technique that relies on the tester's experience to identify errors or defects in a software system.
It involves guessing the types of errors likely to occur and then designing test cases to detect them.
It follows no specific rules.
It depends on the tester's analytical skills and experience.
Common Areas of Error Guessing
- Divide by zero
- Null pointer exception
- Entering blank spaces in text fields
- Pressing Submit without entering values
- Uploading files exceeding maximum limits
- Invalid parameters
- Refresh buttons
Benefits
- Effective when combined with other formal testing techniques.
- Reveals defects that would otherwise be impossible to find through formal testing.
- Saves a lot of time and effort.
- Helps detect errors in complex and problematic areas of the application.
Drawbacks
- Dependent on the tester's experience and skills.
- Does not guarantee the software has reached the expected quality.
- Does not provide full coverage of the application.
Error Seeding
Error seeding is the process of intentionally introducing known faults into a program to monitor the rate of detection and removal and estimate the number of remaining faults.
It determines:
- The rate at which software tests detect errors.
- The number of undetected errors in the system.
These metrics measure:
- The quality of the source code.
- The effectiveness of the test cases.
The core concept is to insert or "seed" errors into the code, then count the number of errors detected and the number remaining after testing.
Experience-Based Techniques
In experience-based techniques, people's knowledge, skills, and background are the prime contributors to the test conditions and test cases.
The experience of both technical and business people is important, as they bring different perspectives to test analysis and design.
Due to previous experience with similar systems, they may have insights into what could go wrong, which is very useful for testing.
Statement, Branch & Decision Testing
Statement Testing (Statement Coverage)
A white-box technique in which all executable statements in the source code are executed at least once.
The purpose is to cover:
- All possible paths.
- All lines.
- All statements in the source code.
Branch Testing (Branch Coverage)
A white-box method in which every outcome from a code module (statement or loop) is tested.
The purpose is to ensure that each decision condition from every branch is executed at least once.
Decision Testing
Checks the application's behavior by providing different input combinations and observing the resulting outputs.
It is also called Branch Testing, where different inputs are supplied to check a particular condition.
Static vs Dynamic Testing
Static Testing
Used on the verification side.
Testing the application with documents, walkthroughs, and inspections is called static testing.
No code execution is involved.
Dynamic Testing
Dynamic testing involves execution of code.
Once the software is ready, we test it by providing inputs and observing the results.
This is the actual testing of functionality.
It is used on the validation side in the V-Model and includes:
- Unit Testing
- Integration Testing
- System Testing
- UAT
Mutation Testing
Mutation testing is a type of testing in which statements of the source code are changed (mutated) to determine whether test cases can detect errors in the source code.
It identifies whether a set of test data or test cases is useful by intentionally introducing code changes (bugs) and retesting with the original test data/test cases to determine if the bugs are detected.
Purpose
- To check the quality of test cases.
- To create more effective test cases.
- To find ambiguities in the code that may cause the system to fail.
Steps to Execute Mutation Testing (Mutation Analysis)
-
Faults are introduced into the source code by creating many versions called mutants.
Each mutant should contain a single fault.
The goal is to make the mutant fail, demonstrating the effectiveness of the test cases.
-
Test cases are applied to both the original and mutant programs.
A test case should be adequate and tweaked to detect faults.
- Compare the results of the original and mutant programs.
-
If the original and mutant programs produce different outputs, the mutant is killed by the test case.
The test case is sufficient to detect the change.
-
If they generate the same output, the mutant is kept alive.
More effective test cases need to be created to kill all mutants.
FAQs
1. What are test design techniques?
Methods that help design better test cases and reduce the number of test cases that need to be executed.
2. What is Boundary Value Analysis?
A black-box technique that tests the boundary values of valid and invalid partitions.
Typically:
- Min
- Min ± 1
- Max
- Max ± 1
3. What is Equivalence Partitioning?
A black-box technique that divides the input domain into classes of data and derives test cases by picking a value from each class.
It reduces the total number of test cases.
4. What is Decision Table Testing?
A systematic technique that captures different input combinations and their corresponding outputs in a table.
It uses:
- True (T)
- False (F)
to cover all condition combinations.
5. What is State Transition Testing?
A black-box technique that observes system behavior for input conditions passed in sequence.
It uses both valid and invalid inputs.
Example: An ATM blocks an account after three wrong PINs.
6. What is the difference between Error Guessing and Error Seeding?
Error Guessing
Designs tests based on the tester's guess of likely faults.
Error Seeding
Intentionally inserts known faults to measure detection rates and estimate remaining faults.
7. What is the difference between Static and Dynamic Testing?
Static Testing (Verification)
Reviews documents through walkthroughs and inspections without executing code.
Dynamic Testing (Validation)
Executes code with inputs and observes the results.
8. What is Mutation Testing?
A technique that mutates source code statements to check whether the test cases can detect the introduced faults.
It measures the quality of the test cases.
9. What is the difference between Statement Coverage and Branch Coverage?
Statement Coverage
Ensures every executable statement runs at least once.
Branch Coverage
Ensures every outcome of each decision or branch is executed at least once.