Specification-Based Test Case Design Techniques
Chanuka Nayanajith
Associate Software Quality Assurance Engineer | ISTQB? CTFL | BSc in IT, Manual Testing
?Identifying the claims made in the specs and testing the product's performance against them.
?Focuses solely on the functions of the software, not on how it operates.
?Do not need to understand the structure of the system or component.
?Also referred to as Black Box Testing and Behavior Based Testing.
?Use the program specification as a guide for choosing and determining the appropriateness of test data.
?Any specific written document, group of use cases, collection of models, or prototype can be used as a specification.
Types of Specification Based Testing Techniques
1. Equivalence Partitioning
? Equivalence Partitioning partitions data according to the assumption that the test object will treat each component of a particular partition identically.
? A method for guaranteeing optimal test coverage with a minimum number of test cases.
? The divisions might be finite or infinite, ordered or unordered, continuous or discontinuous. The divisions have to be non-empty sets and cannot overlap.
? Equivalency partitioning may be straightforward for basic test objects, but in actual use, it is sometimes difficult to grasp how the test object would handle various values.
? Partitioning should thus be done carefully.
? A valid partition is one that has valid values in it. An invalid partition is one that has invalid values in it. Teams and organizations may have different definitions of what constitutes valid and incorrect values. Valid values, for instance, might be seen as those that the test object ought to process or as those whose processing is specified in the specification. Invalid values might be understood as those for which the test object specification defines no processing or as those that the test object should reject or ignore.
? The equivalency partitions in equivalency partitioning are the coverage components. Test cases must exercise all identified partitions (including invalid partitions) by covering each partition at least once in order to obtain 100% coverage using this method. Coverage is calculated as a percentage by dividing the number of partitions exercised by at least one test case by the total number of partitions that have been discovered.
? Equivalence partitioning works under specific presumptions.
?? Every test input variation inside a partition will be handled by the system in the same manner.
??Every other input condition inside the partition will also pass if one of the input conditions passes.
?? Every other input condition inside the partition will also fail if one of the input conditions fails.
? The degree to which the aforementioned assumptions are plausible determines the efficacy and success of equivalence partitioning.
How to do Equivalence Partitioning?
Example:-
Consider the behavior of “Order Pizza” text box given below.
Requirement of the above function.
- Pizza values 1 to 10 are considered valid. A success message is shown.
- Pizza values less than 1 are considered invalid and an error message will appear, “Please enter a valid count“.
- Pizza values grater than 10 are considered invalid and an error message will appear, "Only 10 Pizzas can be ordered at a time“.
Answer:-
The test condition is as follows:
?? Any number less than 1 that is 0 or below is considered invalid.
Enter Pizza Value = -1
?? Numbers 1 to 10 are considered valid.
Enter Pizza Value = 5
?? Any Number greater than 10 is considered invalid.
Enter Pizza Value = 15
2. Boundary Value Analysis
? A software testing technique in which tests are designed to include representatives of boundary values in a range.
? Exercise of the borders of equivalency divisions is the foundation of the Boundary Value Analysis (BVA) approach.
? Consequently, BVA is limited to usage with ordered partitions.
? A partition's border values are its maximum and minimum values.
? When it comes to BVA, any elements that are between two elements that belong to the same partition must likewise belong to that partition.
? Because boundary values are where developers are most likely to make mistakes, boundary value analysis concentrates on the divisions' border values.
? When implemented boundaries are positioned incorrectly—above or below their intended places, or absent entirely boundary value analysis typically finds faults in these areas.
How is Boundary Value Analysis Performed?
- Refer to the same example of order pizza form (on equivalence partitioning) where the user is required to enter the count.
- The first step of boundary value analysis is to create the equal partitions.
- Concentrate on the valid partition, which ranges from 1 - 10.
领英推荐
1. Identify the exact boundary value of this partition Class -> 1 and 10
2. Get the boundary value which is one less than the exact boundary -> 0 and 9
3. Get the Boundary Value which is one more than the precise Boundary -> 2 and 11
?? Valid Boundary Conditions : Count= 1, 2, 9, 10
?? Invalid Boundary Conditions : Count= 0, 11
Boundary Value Analysis with Equivalence Partitioning
- Refer to the previous example;
?? Equivalence partition analysis gives test conditions as -2, 5, 15
?? Boundary value analysis gives test conditions as 0, 1, 2, 9, 10, 11
Drawbacks of Boundary Value Analysis
?? The applications' assumption for boundary value and equivalency partitioning is that it won't let us enter any more characters or values. However, this assumption isn't true in every situation.
?? Boundary value analysis cannot handle situations where the decision depends on more than one input values.
3. Decision Tables
?? Decision tables are used to verify how well system requirements that outline how various combinations of conditions produce various results are implemented.
?? Decision tables are a useful tool for capturing intricate reasoning, such business principles.
?? Decision tables give developers and testers alike an organized means of expressing intricate business rules.
?? Decision tables can be used in test design whether or not they are used in specifications, as they help testers explore the effects of combinations of different inputs and other software states that must correctly implement business rules.
?? The conditions and the system's subsequent actions are specified while making decision tables. These make up the table's rows. Every column denotes a decision rule that specifies a distinct set of criteria and the corresponding actions. All of the criteria and action values in limited-entry decision tables are displayed as Boolean values (true or false), with the exception of those that are unnecessary or impractical (see below). As an alternative, some or all of the criteria and actions in extended-entry decision tables may additionally take on various values (e.g., ranges of numbers, equivalency partitions, discrete values).
How to use Decision Tables for test designing?
- It is better to deal with large numbers of conditions by dividing them into subsets and dealing with the subsets one at a time.
2. Put all identified functions into a table, listing all the combinations of True and False for each of the aspects.
Example 1:-
- The two conditions are the loan amount and the term. Therefore, put them in a table.
3. Identify all of the combinations (rules) of True and False.
- With two conditions, each of which can be True or False, there will be four combinations.
4. Identify the correct outcome for each combination. In this example, user can enter one or both of the two fields. Each combination is also referred to as a rule.
Decision Tables for test designing
?? What occurs if none of the two fields has any information from the customer?
?? A combination that wasn't specified in the specification is shown in the table.
?? Can presume that an error notice should appear after this combo. Therefore, add another action to the decision table.
?? This demonstrates how effective this method is in finding ambiguities and omissions in specifications.
?? Certain combinations are frequently left out of specifications. As a result, this is another useful method to apply while going over the test base.
How to use decision tables for test designing?
?? The final step of this technique is to write test cases to exercise each of the four rules in our table.