Test Case Design Techniques
Test Case Design Techniques
Equivalence Partitioning:
In this method the input domain data is divided into different equivalence data classes. This
method is typically used to reduce the total number of test cases to a finite set of testable test
cases, still covering maximum requirements.
In short it is the process of taking all possible test cases and placing them into classes. One test
value is picked from each class while testing.
E.g.: If you are testing for an input box accepting numbers from 1 to 1000 then there is no use
in writing thousand test cases for all 1000 valid input numbers plus other test cases for invalid
data.
Using equivalence partitioning method above test cases can be divided into three sets of input
data called as classes. Each test case is a representative of respective class.
So in above example we can divide our test cases into three equivalence classes of some valid
and invalid inputs.
Test cases for input box accepting numbers between 1 and 1000 using Equivalence
Partitioning:
1) One input data class with all valid inputs. Pick a single value from range 1 to 1000 as a valid
test case. If you select other values between 1 and 1000 then result is going to be same. So one
test case for valid input data should be sufficient.
2) Input data class with all values below lower limit. I.e. any value below 1, as an invalid input
data test case.
3) Input data with any value greater than 1000 to represent the third invalid input class.
So using equivalence partitioning you have categorized all possible test cases into three classes.
Test cases with other values from any class should give you the same result.
We have selected one representative from every input class to design our test cases. Test case
values are selected in such a way that largest number of attributes of equivalence class can be
exercised.
Boundary value analysis is a next part of Equivalence partitioning for designing test cases where
test cases are selected at the edges of the equivalence classes.
Test cases for input box accepting numbers between 1 and 1000 using Boundary value
analysis:
1) Test cases with test data exactly as the input boundaries of input domain, i.e. values 1 and
1000 in our case.
2) Test data with values just below the extreme edges of input domains, i.e. values 0 and 999.
‐‐‐‐‐‐‐‐‐‐‐‐
3) Test data with values just above the extreme edges of input domain, i.e. values 2 and 1001.
Boundary value analysis is often called as a part of stress and negative testing.
Note: There is no hard‐and‐fast rule to test only one value from each equivalence class you
created for input domains. You can select multiple valid and invalid values from each
equivalence class according to your needs and previous judgments.
E.g. if you divided 1 to 1000 input values invalid data equivalence class, then you can select test
case values like: 1, 11, 100, 950 etc. Same case for other test cases having invalid data classes.
This should be a very basic and simple example to understand the Boundary value analysis and
Equivalence partitioning concept.
What is Decision Table in Software Testing
With Example?
A decision table is a good way to deal with different combination inputs with their associated
outputs and also called cause-effect table. Reason to call cause-effect table is an associated
logical diagramming technique called ’cause-effect graphing that is basically use to derive the
decision table.
Decision table testing is black box test design technique to determine the test scenarios for
complex business logic.
We can apply Equivalence Partitioning and Boundary Value Analysis techniques to only specific
conditions or inputs. Although, if we have dissimilar inputs that result in different actions being
taken or secondly we have a business rule to test that there are different combination of inputs
which result in different actions. We use decision table to test these kinds of rules or logic.
A decision table is basically an outstanding technique used in both testing and requirements
management. It is a structured exercise to prepare requirements when dealing with complex
business rules. Also, used in model complicated logic.
Next, recognize all of the combinations in “Yes” and “No” (In Table 2). In each column of two
conditions mention “Yes” or “No”, user will get here four combinations (two to the power of the
number of things to be combined). Note, if user has three things to combine, they will have eight
combinations, with four things, there are 16, etc. Because of this, it’s always good to take small
sets of combinations at once. To keep track on combinations, give alternate “Yes” and “No” on
the bottom row, put two “Yes” and then two “No” on the row above the bottom row, etc., so the
top row will have all “Yes” and then all “No” (Apply the same principle to all such tables).
In the next step, recognize the exact outcome for each combination (In Table 3). In this example,
user can enter one or both of the two fields. Each combination is sometimes referred to as a step.
At this time you didn’t think that what will happen when customer don’t enter anything in either
of the two fields. The table has shown a combination that was not given in the specification for
this example. This combination can result as an error message, so it is necessary to add another
action (In Table 4). This will flash the strength this method to find out omissions and ambiguities
in specifications.
TABLE 4: Decision table – Additional outcomes
We will provide you some other example that allows the customer to enter both repayment and
term. This will change the outcome of our table, this will generate an error message if both are
entered (Shown in Table 5).
The final process of this method is to write test cases to use each of the four steps in our table.
Boundary Value Analysis is the most commonly used test case design method for black box
testing. As all we know the most of errors occurs at boundary of the input values. This is one of
the techniques used to find the error in the boundaries of input values rather than the center of the
input value range.
The equivalence class partition is the black box test case design technique used for writing test
cases. This approach is use to reduce huge set of possible inputs to small but equally effective
inputs. This is done by dividing inputs into the classes and gets one value from each class. Such
method is used when exhaustive testing is most wanted & to avoid the redundancy of inputs.
The equivalence class partition is the black box test case design technique used for writing test
cases. In this techniques the design the test cases for the system which describes the finite
number of states. The state transition from one to other is based on the state of machine and
depending upon the what happened before the output is varies for same inputs.
The Cause-Effect Graphing Technique is a black box testing technique which captures the
relationships between specific combinations of inputs(causes) and outputs (effects). It deals with
specific cases & avoids the combinatorial explosions. The graph includes a number of
intermediate nodes linking causes and effects. Each Causes/effects are represented as nodes of a
cause effect graph.
Error Guessing
This is totally based on previous experience and judgment of tester. Good tester are encouraged
to think conditions in which software may get the highest chances of getting errors. Such
techniques do not have any rules to decide & totally based on experience.
What is State transition testing technique?
State transition technique is a dynamic testing technique, which is used when the system is
defined in terms of a finite number of states and the transitions between the states is governed by
the rules of the system.
Or in other words, this technique is used when features of a system are represented as states
which transforms to other state. The transformations are determined by the rules of the software.
The pictorial representation can be shown as:
So here we see that an entity transitions from State 1 to State 2 because of some input
condition, which leads to an event and results to an action and finally gives the output.
You visit an ATM and withdraw $1000. You get your cash. Now you run out of balance and
make exactly the same request of withdrawing $1000. This time ATM refuses to give you the
money because of insufficient balance. So here the transition, which caused the change in state
is the earlier withdrawal
In practical scenario, testers are normally given the state transition diagrams and we are required
to interpret it. These diagrams are either given by the Business Analysts or a stakeholder and we
use these diagrams to determine our test cases.
Reset (R)
If the display mode is set to T or D, then a “reset” shall cause the display mode to be set to “alter
time (AT)” or “alter date (AD)” modes.
Display Time(S1),
Change Time(S3),
Display Date(S2) and
Change Date (S4).
Change Mode(CM),
Reset (R),
Time Set(TS),
Date Set(DS).
Alter Time(AT),
Display Time(T),
Display Date(D),
Alter Date (AD).
Display Time(S1),
Change Time (S3),
Display Date (S2) and
Change Date (S4).
Step 1:
Write all the start state. For this, take one state at a time and see how many arrows are coming
out from it.
For State S1, there are two arrows coming out of it. One arrow is going to state S3 and other
arrow is going to state S2.
For State S2 – There are 2 arrows. One is going to State S1 and other going to S4
For State S3 – Only 1 arrow is coming out of it, going to state S1
For State S4 – Only 1 arrow is coming out of it, going to state S2
Since, for state S1 and S2 there are two arrows coming out, we have written it twice.
Step -2:
------------
Step 3:
For each start state and its corresponding finish state, write down the input and output conditions
– For state S1 to go to state S2, the input is Change Mode (CM) and output is Display Date(D)
shown below:
In a similar way, write down the Input conditions and its output for all the states as follows:
Step 4:
Now add the test case ID for each tests shown below:
Conclusion:
1. Identify the initial states and their final state based on the lines/arrows that are coming out of
the initial state
2. For each initial state, find out the input condition and the output result
3. Mark each set as a separate test case.
State Transition testing is a unique test approach for testing complex applications, which
would increase test execution productivity without compromising on test coverage.
Cause and effect graph is a dynamic test case writing technique. Here causes are the input
conditions and effects are the results of those input conditions.
Cause-Effect Graphing is a technique which starts with set of requirements and determines the
minimum possible test cases for maximum test coverage which reduces test execution time and
ultimately cost.
The goal is to reduce the total number of test cases still achieving the desired application quality
by covering the necessary test cases for maximum coverage.
But at the same time obviously there are some downsides of using this test case writing
technique. It takes time to model all your requirements into this cause-effect graph before writing
test cases.
The Cause-Effect graph technique restates the requirements specification in terms of logical
relationship between the input and output conditions. Since it is logical, it is obvious to use
Boolean operators like AND, OR and NOT.
Situation:
The “Print message” is software that read two characters and, depending of their values,
messages must be printed.
Solution:
LET’S START!!
The circle in the middle is just an interpretation of the middle point to make the graph less
messy.
There is a third condition where C1 and C2 are mutually exclusive. So the final graph for effect
E1 to be true is shown below:
------------
This completes the Cause and Effect graph for the above situation.
Now let’s move to draw the Decision table based on the above graph.
First write down the Causes and Effects in a single column shown below
Key is the same. Go from bottom to top which means traverse from effect to cause.
Start with Effect E1. For E1 to be true, the condition is: (C1 C2) C3 .
Here we are representing True as 1 and False as 0
So it’s done. Let’s complete the graph by adding 0 in the blank column and including the test
case identifier.
I am writing a sample test case for test case 1 (TC1) and Test Case 2 (TC2).
Conclusion
This finishes the Cause and Effect graph dynamic test case writing technique. We have seen how
to draw the graph and how to draw the decision table based on it. The final step of writing test
cases based on decision table is comparatively easy.