Optimize Test Case Coverage with Equivalence Partitioning & Boundary Value

Learn how Equivalence Partitioning & Boundary Value can improve your test efficiency

Proper testing of software is vital to the Ice House Methodology. That’s why we are always keen to learn better and more efficient ways to test our software.

What is the Software Testing Life Cycle

The Software Testing Life Cycle (STLC) is a sequence of activities conducted during the testing process to ensure software quality goals are met. It is not simple as the tester is required to help certify the quality of the software product, during the testing phase. 

Fundamentals of Software Testing | Medium
Picture 1. The Phases of STLC Model

The six major phases STLC:

  1. Requirement Analysis
  2. Test Planning
  3. Test Case Development
  4. Test Environment Setup
  5. Test Execution
  6. Test Cycle Closure

Note that the entry and exit criteria are defined, and activities & deliverables are associated with every phase in the STLC. 

In this blog post, I will only explain the Test Design technique which is part of the Test Case Development phase in the STLC. 

Test Design – Test Case Development Phase

What is Test Design?

Test Design is an activity that describes “how” the testing should be done. It includes a process for identifying test cases by enumerating steps of the defined test conditions. Hence the Test Design in the STLC phase is also called the Test Case Development phase. 

During the Test Design or Test Case Development phases, there are activities that need to be done. These are the activities in the test design phase (1):

  • Reviewing the test basis – such as: requirements, software integrity level (risk level), risk analysis reports, architecture, design and interface specifications. 
  • Evaluating the testability of the test basis and test objects. 
  • Identifying and prioritizing test conditions based on the analysis of the: test items, specification, behaviour and structure of the software. 
  • Designing and prioritizing high-level test cases
  • Identifying necessary test data to support the test conditions and test cases
  • Designing the test environment setup and identifying any required infrastructure and tools
  • Creating bi-directional traceability between test basis and test cases. 

The following diagram shows the different activities that form part of the Test Case Development phase. (2)

Picture 2. Diagram of Test Case Development phase

Besides the activities in the test design phase, there are also the deliverables during this phase, which are:

The importance of Test Design Techniques

Test design techniques are implemented with the purpose of ensuring that the products meet the expectations of clients and their businesses. Implementing the test design techniques in the test cases development phase helps the testers to execute the test effortlessly based on the analysis and the various risk factors that will be identified before the execution starts. Standards that help to smooth the testing process include:

  • Gather information to understand the user requirements
  • Derive all important business scenarios
  • Design test scenarios for every derived critical business scenario
  • Assign all planned test scenarios to different test cases. 

As a software tester, you will have to choose a test design technique for each requirement. Two main advantages of test design techniques are:

  • Possibility to reproduce a test

During several testing phases, testing techniques are considered as a set of rules to help ensure a minimum level of consistency. While designing the test cases with these techniques, testers will work more efficiently as it has a base that would help to reduce a significant amount of effort later on while fixing. 

  • Increasing the found bugs

The cost of the bugs found in the software can be measured by the impact and severity along with the stage that the testers find them. The earlier the bug is found, the lower the cost of the bug. Hence, implementing the test design techniques could help the testers to find bugs as early as possible before the execution test begins. 

Test Design Techniques

Test Design Technique is a procedure for determining test conditions, test cases, and test data during software testing. Test design techniques are also the strategies that help to write better test cases. A benefit of using test design techniques is that you get an opportunity to create fewer tests while ensuring broad requirements coverage. 

There are many different types of software testing design techniques, each with its own strengths and weaknesses. (3)

Test basisTest design categoryTest design technique
Informal requirementsSpecification-basedEquivalence partitioning
Boundary value analysis
Decision table
Cause and effect graphing
Use case testing
User story testing
Classification treeAd hoc testing
Semi-formal or formal requirementsModel-based Model checkingState transition testing
Syntax testing
Structure (e.g. code)Structure-basedControl-flow testing
Data-flow testing
Path testing
Condition testing
Mutation testing
ExperienceExperience-basedError guessing
Exploratory testing
Attack Testing
Checklists
Faults, failuresFault-basedFailure-based
Taxonomy-based testing
Table 1. List of Test Design Techniques

There are 5 test design techniques that are mostly used in software testing, which are: Equivalence Partitioning, Boundary Value Analysis, Decision Table Testing, State Transition Testing, and Error Guessing.  This post will be the first part of a series of Test Design Techniques posts. In this Part, we will only discuss the Equivalence Class Partitioning and Boundary Value Analysis. The remaining three techniques will be discussed in the Part 2 post.

Equivalence Partitioning

What is Equivalence Partitioning

Equivalence Partitioning is also known as Equivalence class partitioning (ECP). It is a software testing technique or black box testing that divides input domains into classes of data, and with the help of these classes of data, test cases can be derived.

The equivalence partitions are derived from the requirements and specifications of the software. In this technique, the data or the test cases are partitioned into form data sets that are called equivalence classes or partitions. On each partition, only one test case or data is required to test as the sets of each partition are considered equal by the software, hence it’s called “equivalence partitioning”. If one data from one partition works properly, then it can be concluded that the other data from the same partition would also work properly with the software. However, if it does not work, then the whole data group in that partition can be ignored, as it can be concluded that other data would not work as well. 

Guidelines for Equivalence Partitioning:

  1. If the input given is the range condition, then there should be one valid and two invalid equivalence classes defined. Valid means it should be within range and too large or too small is invalid. 

Example:

Picture 3. Sample UI for Age text field

There is a function of a software application that accepts only a particular range. Consider an Age field that only allows between ages 18 to 56, other ages would not be accepted and the application will redirect customers to an error page.
The Equivalence partitioning would be as follows:

Picture 4. Equivalence partitioning for the input is the range condition
  1. If the input given requires a member of an enumerated set where all values are treated the same, then there should be one valid class for values in the set and one invalid equivalence class defined. 

Example:
Given the enumerated set for San Luis Obispo {SLO, San Luis, Slo Town}.
The Equivalence partitioning would be as follows:

Picture 5. Equivalence partitioning for the input requires a member of an enumerated
  1. If the input given requires a member of an enumerated set where each is treated differently, then there should be one valid class for each value in the set and one invalid equivalence class defined. 

Example:
Given the enumerated set for Vehicle = {car, truck, motorcycle}
The Equivalence partitioning would be as follows:

Picture 6. Equivalence Partitioning for the input requires a member of an enumerated set where each is treated differently.
  1. If the input condition given is boolean, then there should be two valid classes defined. 

Example:
There is a function in the software to evaluate whether each student’s grade is a pass or fail. If the grade >= 65, then the student obtained a passing grade, if the grade <65 then the student receives a failing grade.

The equivalence partitioning would be as follows:
Valid: In the case of a student with a grade of 83, the first statement will return as true
Invalid: In the case of a student with a grade of 59, the first statement will return as false. 

Advantages and disadvantages of Equivalence Partitioning technique:

Advantages of Equivalence PartitioningDisadvantages of Equivalence Partitioning
Equivalence Partitioning is suitable for software projects with time and resource constraintsThe identification of the equivalence classes relies on the ability of the testers who create these classes and the test cases based on them. 
The testing technique helps in delivering a quality product within a short time period. In the case of complex applications, it is very difficult to identify all sets of equivalence classes and requires a great deal of expertise from the test engineer’s side. 
It helps to decrease the general test execution time and also reduces the set of test data. Incorrectly identified equivalence classes can lead to smaller test coverage and the possibility of defect leakage. 
Provide a sense of complete testing and eradicates the need for exhaustion testing. Suitable only for range-wise and discrete values input data. 
Table 2. Advantages and disadvantages of Equivalence Partitioning technique

Boundary Value Analysis (BVA)

What is Boundary Value Analysis

Boundary value analysis is one of the widely used case design techniques for black box testing. Boundary value analysis is a software testing technique in which tests are designed to include representatives of boundary values in a range and it includes maximum, minimum, inside or outside boundaries, typical values and also error values. 

By using the test data residing at the boundaries, there is a higher chance of finding errors in the software application. 

Guidelines for Boundary Value Analysis

Boundary value analysis involves the use of equivalence partitions. The input data to the software is first of all divided into divisions called equivalence class partitions. 

  1. If the input condition is restricted between values x and y, then the test cases should be designed with values x and y as well as values which are above and below x and y. 
  2. If an input condition is a large number of values, the test case should be developed which needs to exercise the minimum and maximum numbers. Here, values above and below the minimum and maximum values are also tested. 

Example:
Let’s consider the same example we used in the equivalence partitioning section. An application that accepts a numeric number as input with a value between 18 to 56. 
While testing such applications, we will not only test it with values from 18 to 56 but also with other sets of values like less than 18, greater than 18, special characters, alphanumeric, etc. 
The boundary values will be as follows:

Advantages and Disadvantages of Boundary Analysis Value

Advantages of BAVDisadvantages of BAV
The density of defects at boundaries is larger, hence it’s easier and faster to find defects using this technique. The success of the testing using this technique depends on the equivalence classes identified, which further depends on the expertise of the tester and his/her knowledge of the application. Incorrect identification of equivalence classes leads to incorrect boundary value testing. 
BAV technique is able to reveal any potential UI or user input defect found in the softwareBAV is not as effective when dealing with Boolean variables.
BAV is an ideal approach to use when the functionality of a program is based on numerous variables that represent physical quantitiesBoundary Value Analysis is not suitable for applications with open boundaries or applications that don’t have one-dimensional boundaries. 
Table 3. Advantages and Disadvantages of Boundary Analysis Value

Key Takeaways:

  1. Test Design Technique is a procedure for determining test conditions, test cases, and test data during software testing. Test design techniques are also the strategies that help to write better test cases.
  2. Two main advantages of using test design techniques are: helping the testers work more efficiently as it has a base which will help to reduce the significant amount of effort in later fixing and also increasing the probability of finding more bugs in early phases. 
  3. There are 5 test design techniques that are mostly used in software testing, which are: Equivalence Partitioning, Boundary Value Analysis, Decision Table Testing, State Transition Testing, and Error Guessing. 
  4. In Equivalence partitioning, there are 4 types of input to define the partition which are input with range condition, input that requires a member of an enumerated set where all values are treated the same, input that requires a member of an enumerated set where each is treated differently, and input is a boolean. 
  5. Boundary value analysis involves the use of equivalence partitions. 

References:

  1. ISTQB – Foundation, Test Analysis and Design
  2. Activity of Test Case Development
  3. Test Design techniques categories and test basis
2
Share

More Articles

let's talk illustration

Loving what you're seeing so far?

It doesn’t have to be a project. Questions or love letters are fine. Drop us a line

Let's talk arrow right