Domain Analysis Testing
The domain analysis testing has the features of both equivalence class partitioning (ECP) and boundary value analysis (BVA). Of course, the test cases created by using domain analysis testing are less than ECP and BVA combined.
Application of Domain Analysis Testing
The domain analysis testing is particularly suitable where the output depends on the combination of input variables and the input variables are correlated with each other by some relationship. For instance, in aspect ratio of videos, the width and height parameters are related with each other. When we increase width, the height also changes accordingly.
The value written in the given condition is on point. For instance, in following conditions, 100, 200, 5 and 900 are on points.
x < 100, x>= 200, x<>5, x =900
All the valid values for any given condition are in points. If the condition is x>500, all the values greater than 500 are in points.
All the invalid values for any given condition are out points. If the condition is x >500, all the illegal values like 500, 499, 498…………………… are out points.
Finding off point for any condition is somewhat tricky.
Method 1 to find off point
The off point lies next to the on point. It depends on the fact whether the boundary is open or closed.
- If the boundary is closed like <=, >=, = the on point is inside and off point is next to it on the outside.
- For x <= 100, the on point is 100. It is inside the domain. The off point would be next to it but outside the domain that is 101
- For x >= 100, the on point is 100 and inside the domain. The point would be next to it but outside the domain that is 99.
- For x = 100, the on point is 100 and inside the domain. In fact, here “on point” is the only in point, all other points are outside the domain. The off point is next to the “on point” outside the domain. Since there are two points next to the “on point” that lie outside the domain, so there are two off points in this case, that is , 101 and 99.
- If the boundary is open like <, > <>, the on point lies outside the domain and the off point lies next to the on point inside the domain.
- For x < 100, the on point is 100 that is outside the domain. The off point would be next to the “on point” inside the domain that is 99.
- For x > 100, the “on point” is 100 that is outside the domain, the off point would be next to the off point but inside the domain that is 101.
- For x <> 100, the on point is 100 that is outside the domain, all other points are inside the domain. The off points are the points next to the “on point”. There are two points next to the on point in this case. Hence, the off points are 99 and 101.
Method 2 to find off point.
In this method, you can draw any given condition graphically. You divide the space in two parts. The inside the domain part and outside the domain part. There are always two points between these two parts. One of them is the “on point” and the other is the off point.
- For x <= 100, if we divide the space in two parts, all the values which are equal to 100 or less than 100 are inside the domain. Whereas all the values which are greater than or equal to 101 are outside the domain. So there two points between inside and outside parts that is 100 and 101. The 100 is given in the condition, hence it is on point, and the point i.e. 101 is the off point.
- For x > = 100, if we divide the space in two parts, all the values which are equal to 100 and above are inside the domain and all the values which are equal to 99 or less are outside the domain. Here have 2 points, 100 and 99. The 100 point is given in the condition, so it is “on point”, the other point that is 99 is off point.
- For x == 100, we can divide the given space into three parts. The valid domain is only one value that is 100. The invalid domains are 99, less than 99, 101 and more than 101. So the on point is the given point that is 100 and off points are other two points which are adjacent to it that is 99 and 101.
- For x < 100, we have valid domain that is 99 and less than 99. We have invalid domain that is 100 and more than 100. Here we have two points between valid and invalid domains and those points are 99 and 100. The 100 is given in the condition x < 100 so it is on point. Whereas the other point is 99 so it is off point.
- For x > 100, the valid domain is 101 and above where the invalid domain is 100 and less. 100 is “on point” and 101 is off point.
- For x <> 100. The valid points are 101 and above and 99 and less. The invalid point is 100. There are three points here. The given point 100 is on point and the other points 99 and 101 are off points.
How to write test cases for domain analysis testing?
Suppose we have three variables x, y and z. We will write test cases with following logic.
- Use on point for x and use in points for y and z.
- Use off point for x and use in points for y and z.
- Use on point for y and use in points for x and z.
- Use off point for y and use in points for x and z.
- Use on point for z and use in points for x and y.
- Use off point for z and use in points for x and y.
In short, we write test cases to test on and off point for every parameter while using in points for other parameters.
Say there is a university which uses two parameters (GPA and marks in admission test) to compute eligibility for admission. Formula to take admission is
GPA x 10 + marks in admission test > = 100
The maximum value for GPA is 4.0 and the maximum marks for test are 80. If a candidate has 3.0 gpa and secures 70 marks in test, he would be eligible according to the formula.
3.0 x 10 + 70 = 30 + 70 = 100.
If the candidate has 3.5 gpa and secures 75 marks in the admission test, he would have 110 points and will be elgible.
3.5 x 10 + 75 = 35 + 75 = 110
But if a candidate has gpa is 3.0 and he secures 60 marks in admission test, the total would be 30 + 60 = 90 which less than the minimum threshold, so he would be ineligible.
Now let us write test cases for such scenario.
- GPA <= 4.0
- On point= 4.0, off point 4.1
- Marks in admission test <= 80.
- On Point 80, off point 81
Let us draw the domain analysis-testing matrix. Binder invented the matrix that is why we also call it Binder Matrix.
If we change the boundaries from closes to open, the off points will shift inside as discussed above. In that case, the Binder Matrix would be like this