This article covers the seven Test Design Techniques I see most often and consider necessary for a tester writing test cases.

For Black-box Testing:

For White-box Testing:

EP — Equivalence Partitioning

Equivalence Partitioning applies to features involving input or input data, where the requirement says the system’s behaviour depends on the input value.

More fully, it is a design technique for splitting test cases for requirements involving value ranges, when the system result specifically depends on the input value. The technique creates equivalence partitions: sets of input values that produce the same output. Since the output is the same, the tester does not need to test every value in every partition; one representative value for each partition is enough.

For example, a feature asks for a user’s age and classifies the user into four groups: child, teenager, adult and elder.

For this requirement, splitting the test cases means applying EP:

First, we split the values into five equivalence partitions: below 0 is invalid, 0 to below 13, 13 to below 19, 19 to below 61, and 61 onwards.

----0----12----18----60----

Then choose representatives: -1 for the invalid partition, 6 for children, 15 for teenagers, 40 for adults and 70 for elders.

---(-1)-0--6--12--15--18--40--60--70--
     |     |      |        |       |

We can now create five High Level Test Cases:

That is EP. How many equivalence partitions there are is how many test cases we get, including both invalid and valid partitions.

BVA — Boundary Value Analysis

BVA — Boundary Value Analysis — is a Test Design Technique created to support EP. Here is where the problem appears.

Developers have to implement the requirement in the product code. In the code, they compare the input variable with the boundaries of the value ranges using operators.

What if they get it wrong? Instead of children being 0<age<=12, they write 0<=age<12. When the input is 12, the system does not behave as required. EP-based testing often skips boundary values. Even if the tester deliberately chooses 12 as a representative value, if the developer also gets 0<age<12 wrong, 12 alone is not enough; we need 0 as well. That is why BVA exists.

The short version is that bugs frequently appear at boundaries because comparison operators are easy to get wrong. BVA is therefore combined with EP to split test cases and cover all situations that can occur.

BVA has two ways to split test cases around each boundary:

For boundary 0, I would usually use 2-value testing: -1 and 0. For boundary 12, I would usually use 3-value testing: 11, 12 and 13. Since 12 sits between two valid partitions, we need to check the boundary and one value on each side.

So the earlier example looks like this with BVA + EP:

---(-1)-0--11-12-13--17-18-19---60-61---
     |  |   |  |  |   |  |  |   |  |

After applying BVA, we have:

You may argue that 0, 11 and 12 have the same result, so test case 11 can be removed; similarly, 17 can be removed from 13, 17 and 18. That is perfectly possible, but it depends on the specific problem. This is test-case simplification, reducing the number of cases we need to write.

Decision Table

The two techniques above apply to requirements involving a range of input values. What if there is more than one input? Like probability exercises at school: if A can have two values and B can have three, the combination of A and B has six values. That is the essence of a Decision Table.

A Decision Table is a Test Design Technique for requirements involving multiple inputs, where the output depends on a particular combination of input values. It creates a Decision Table to help split the test cases.

The table, also called a Conditions/Actions table, has two parts: Conditions and Actions. Conditions contain the inputs; Actions contain the corresponding outputs for each input set.

Decision Table template
Decision Table template

Decision Table template

Conditions are inputs, but what does that mean here?

At first we have four combinations: Correct username + Correct password, Correct username + Incorrect password, Incorrect username + Correct password, and Incorrect username + Incorrect password.

With username and password, the Decision Table before Actions might look like this:

Decision Table with Conditions
Decision Table with Conditions

Decision Table with Conditions

Next, fill in the Actions — the expected results for each input set: Login for the first combination and Not Login for the other three.

Decision Table with Conditions and Actions
Decision Table with Conditions and Actions

Decision Table with Conditions and Actions

Almost done. The remaining problem is simplifying the table and removing unnecessary input sets. Consider two things:

Simplified Decision Table
Simplified Decision Table

Simplified Decision Table

Splitting by combinations is logical for covering all possible situations, but the number of test cases grows exponentially. Simplification is therefore necessary to avoid generating redundant cases.

We end up with three test cases. The Decision Table gives us the basic idea:

To finish the High Level Test Cases, give username and password concrete values:

State Transitioning

State Transitioning applies to requirements involving a workflow or use flow: the user performs a sequence of actions and the state of a specific object changes after each one. In theory it fits a sequence of events and conditions where system behaviour depends on events and conditions in the past.

In simple terms, imagine a login flow, then account settings, then a request to deactivate the account. If the user does not recover it after one week, the account is deleted completely. The object changing state is the account; its states are Active, Inactive and Deleted. Developers turn the requirement into a product, and testers apply State Transitioning to split the test cases.

The process is:

Then write a test case for each state transition of the object.

Here is the same example with more detail:

A user can create an account. From creation, if there are no transactions for six months, the account is automatically deactivated. If it is not recovered during the following six months, it is deleted completely.

Depending on severity, a terms-of-use violation can deactivate the account or delete it immediately.

The user can open account settings and deactivate the account. After deactivation it becomes Inactive; after six months without recovery it is deleted completely.

There are three states: Active, Inactive and Deleted.

6 months no transactionUser deactivate accountViolate low term6 months no recoveryViolate high termActiveInactiveDeleted
// Mermaid diagram

This gives five test cases for five state transitions:

That is State Transitioning.

Statement Testing

Statement Testing, also called Statement Coverage, is a Test Design Technique for White-box Testing. We test the work product while caring about code structure, so this technique is used most often with Unit Tests and Integration Tests. The goal is to split test cases so every executable statement runs at least once.

For example:

if a > 0:
    print('a is positive')
else:
    print('a is negative')

To run every line, we need one case for the if block and one for the else block. They cannot run at the same time, so use a > 0 and a <= 0. With Python knowledge, we can see that handling those two cases is enough.

The two High Level Test Cases are:

The values -5 and 5 represent two partitions; we are also applying EP. If you think the example is missing BVA + EP, you are mixing up the goals. We want every line of code to run, and that is all. Statement Testing, and White-box Testing generally, checks code structure — whether the code is well covered — not whether the logic is correct.

Look at this example:

if a > 0:
     if a == -1:
         print('a is -1')
     else:
         print('a is positive')
else:
     print('a is negative')

There is a code problem: if a is greater than 0, how can if a == -1 ever run? print('a is -1') can never execute for any value of a, so no test combination can reach 100% line coverage. Statement Testing helps identify unreachable lines and simplify the code. It also helps cover faulty code cases.

With a is positive with a = 5, 3/7 lines execute; with a is negative with a = -5, 2/7 execute. Together they execute only 5/7 lines. The print('a is -1') line cannot be covered by any value, so there is a redundant code branch.

Statement Testing usually goes with tracking code coverage, measured as a percentage. Coverage shows the code that has not run. The target percentage should be decided by the team and the risk; 100% statement coverage still does not prove the code is correct.

Decision/Branch Testing

Based on Statement Testing, identify test cases for:

if type(a) == int and a > 0:
    print('a is positive')

if type(a) == str and len(a) > 0:
    print('a is not empty')

Statement Testing gives us two cases:

But what happens when a is an integer and a = -1? The code has result branches that Statement Testing does not cover because no statement handles them. Statement Testing alone is not enough here.

Decision or Branch Testing splits cases so all possible result branches can run, not merely all lines. Decision Testing is broader than Statement Testing: 100% Statement Coverage does not guarantee 100% Decision Coverage, while 100% Decision Coverage implies 100% Statement Coverage.

We need four cases:

No line executes for a = -1 and a = '', but we still need cases for those result branches because the unmet conditions can expose errors. With the four cases, all result branches are covered and the code appears sound.

Here is a clearer example of why Decision Testing matters:

if a > 0:
     'a is positive'
     global b
     b = 1

if b == 1:
     print('b is 1')

With Statement Testing alone, one case is enough:

At a = 5, all six lines run and Statement Coverage reaches 100%. But what happens with the opposite condition, a < 0? The definition of b does not run, causing b is not defined at if b == 1. The a < 0 branch was not handled properly, so we need a case for it:

The first case will certainly fail, allowing us to conclude that the code is not sound yet.

Path Testing

Path Testing combines Statement Testing and Decision Testing: split cases so all lines and all result branches can run. It is one of the more complex Test Design Techniques and is also commonly used in White-box Testing.

The reason to combine them is to cover code that has flow, rather than simply running from top to bottom. Recursive code, loops and similar situations operate by conditions. In my understanding, when the code diagram contains loops, feedback or code involving several inputs, Path Testing is needed.

Consider:

def foo():
     if A == 'red':
          print('A is red')
     if B == 'red':
          print('B is red')

Start with Statement Testing. One case is enough:

That runs all four lines, giving 100% Statement Coverage.

What if A and B are not red? We need two cases to cover the two result branches for both if blocks:

For paths, however, the Decision Table technique tells us there are four value combinations for inputs A and B. We therefore need four cases to cover every path through foo:

In short, without being too mechanical:

Statement Testing splits cases so each line of code runs at least once.

Decision Testing splits cases so each branch of a True/False decision runs at least once.

Path Testing splits cases so all lines and all branches of the code run at least once.

References