3. Advanced Equivalence Partitioning
To summarize what we have learned so far, there are equivalence partitions for both valid and invalid values. Valid values are values that should be accepted by the component or system, and equivalence partition containing valid values is called a valid equivalence partition. The invalid values are values that should be rejected by the component or system, and equivalence partition containing invalid values is called and invalid equivalence boutition double daw.
Each value must belong to one and only one equivalence partition. One value from each botation should be selected. Partitions can be identified for any data element related to the test object, including inputs, outputs, internal values, time related values, for example, before or after an event, and for interface parameters, for example, integrated components being tested during integration. Let me give you an example regarding this point. One value from each partition should be selected. When invalid equivalence partitions are used in test cases, they should be tested individually, meaning that combined with other invalid equivalence partitions to ensure that failures are not masked.
Failures can be masked when several failures occur at the same time, but only one is visible, causing the other failures to be undetected. Let me give you an example regarding this last point. Imagine if we have a screen to enter a password. The password lens is from one to six, but the specs also say that the password should start with alphabet characters but can contain characters and numbers. Okay, this is different here, so we need to list the conditions of the example of the password.
Actually, those are sort of test conditions. Has one to six characters, begins with e to z, contains e to z and z 29 further has one to six characters. We have three partitions, zero characters partition. You cannot enter negative characters from one to six characters partition and more than six characters partition. The one to six characters is a valid partition and the other two are invalid partitions. For the begins with a to z condition, we would have two partitions. It starts with an alphabet character, which is a valid partition and starts with anything else, which is an invalid partition. For the contains a to z and zero to nine condition, we also would have two partitions.
One contains alphanumeric characters, which is a valid partition, and the other partition contains any singles, which is an invalid partition. So we have three valid partitions and four invalid partitions to the total of seven partitions. That would be a question by itself in the exam asking for the total number of partitions. Another question would be what is the minimum number of test cases to cover this problem using equivalents partitioning? Well, let’s agree on some basics here. You want to try at least one value from each partition to achieve 100% coverage. You can combine valid partitions in a single test case, and you cannot combine more than one invalid value in the same tester case. This is the exhibition of the last bone we were talking about. You may ask why. Well, simply, if you have a tester case with two invalid values or two invalid partitions, and the test case successfully displayed an error, I’m afraid you won’t know which invalid value actually reduced the error. So exercise each invalid value in a separate test case. So let’s play with the test cases here.
First test case EB 36 p. This one will exercise all the valid partitions, starts with an alphabet and contains alphanumeric characters and length within range, which is five, and we are done with all the valid partitions. One XY twelve starts with a number, a 15 hash percentage x contains special characters, and we have zero lens, and we have very long, which is above length range, which is seven, and we are done with the invalid bartitions. So we needed five test cases to cover our problem in the exam. You don’t need to write the test cases, but rather see how many test cases can hold all the valid partitions, then add to it the number of invalid partitions. Just make sure you read that question carefully to make sure you understand the constraints you are testing.
Another characteristic of equivalence partitioning is that partitions can be identified for any data element related to the test object, including inputs, outputs, internal values, time related values, for example, before or after an event, and for interface elements, for example, integrated components being tested during integration. Let me give you an example again regarding this last point. So far, we have dealt with inputs as data. We want to create partitions for using our previous password. Example the system would either accept your password or display an error message saying wrong password.
So how many partitions for the output here to approve or reject? So you need only two test cases one that will lead you to go through the approval scenario, and another that would lead you through the rejection scenario. Any value here can be used AB three six p for the approval and one XY twelve for the rejection. That’s it. Just two test cases are needed to achieve 100% coverage on the output partitions. Continuing talking about the characteristics of equivalents partitioning, any partition may be divided into sub partitions if required. Here we simply need to tweet sub partitions as we tweet any partition and one value from each sub partition should be selected. Last point equivalent partitioning is applicable at all test levels of testing.
Looking at the sample questions in the Istkb sample exam, there are three extra points that we need to mention here. The first one is related to coverage. To achieve 100% coverage with this technique, test cases must cover all identified partitions, including invalid partitions, by using a minimum of one value from each partition. Coverage is measured as the number of equivalence partitions tested by at least one value divided by the total number of identified equivalent partitions normally expressed as a percentage. So in our password example, we analyze the problem and agree that we have seven partitions. If the tester decided to use AB three six B and very long only as test cases, for some reason AB three six B exercises three partitions, all the valid partitions and Very Long exercises one invalid partition only. So a total of four partitions have been covered using those two distances.
So the coverage is four divided by seven multiplied by 100 equal almost 57%. The second point is related to using discrete values as input or Albert, whatever meaning. Instead of having a range of numbers, we would have separate discrete values. For example, Mrs and Miss as titles or Egypt, Canada, US and India as a country, the question that pops to mind is should a field like country be in one partition or each value should be in a separate partition? Here we need little understanding of the software at hand. Would the value of the country change the way the software behaves? If the answer is yes, then every value should be in a separate partition. But if the answer is no, then all the values can reside in a single partition. For example, if the country is an input will use gesture your information in a gaming website. I don’t think the country here will have any effect on how the game behaves.
So one partition for all the countries would be fine. But if the country is a field will use an address to ship an item, then each country might have different behavior according to how we calculate the taxes or how we calculate the shipping cost according to the shipping methods valid in that address. In the example mentioned in the Http assemble exam, they used the screen resolution as an input. Of course, each screen resolution would behave differently in displaying an image. That’s why we had to put each screen resolution in a separate partition. The third and last point is having more than one input, and each input has its own botanicians. Let’s assume we have two inputs age from 20 to 60 and country Egypt to Canada, USA and India. The age field has three partitions and the country field has four partitions. Remember when we say that we need to exercise one value from each partition? That’s still the case here we have three plus four equals seven partitions. We need to exercise each partition here. But a single tistic case can carry a value from age and a value from country.
So to use equivalence partitioning in our example, how many tistic cases would we need? Right, four. Simply because the highest number of partitions in a single field is four, which is the field country. Examples of district cases would be ten egypt 40 canada 60 USA. And it doesn’t matter what to use from the age bauticians again to fulfill the 100 test coverage. So say the fourth district case would be 45 India. I wanted to use the fact that we can test a boutition here once again, which is a valid boutition. And so instead of using 40 again, I decided to use 45. So I simply decided to use a different value. That’s it. Actually. Those points of multiple inputs, calculating test coverage and discrete values are discussed in detail in the Test Analyst Advanced level. I hope they make sense to you. Not.
4. Boundary Value Analysis
Both Beiser and American Software Engineering author says that bugs log in corners and congregate at boundaries. One thing we know about the kinds of mistakes that programmers make is that errors tend to cluster around boundaries. Some developers might get confused about our employee age and unintentionally get confused about the numbers 20, n, 50 and boot them out of range. A developer might use the wrong comparison sign and use less than, instead of less than or equal or vice versa. There are many ways developers can make such mistakes. Boundary value analysis works hand in hand with our equivalence boutitioning from the previous lectures because boutitions have boundaries but can only be used when the boutation is ordered. Consisting of numeric or sequential data, the minimum and maximum values of first and last values of the partition are its boundary values. In our employee age, where we have the accepted employee age in the range from 20 to 50, we had three partitions. So we need to identify the boundaries for each partition.
The first partition, 20 to 50, has the boundaries of 20 and 50 which are valid boundaries, assuming we can limit the input so no negative numbers are allowed. The second partition, less than 20, has a boundary of zero and 19. The third partition, above 50 has a boundary of 51. And there is no second boundary in this partition because it extends to bosdev infinity. The technique used here is called two values bare boundary, meaning if we look from the valid partition point of view for the lower boundary we identify the value at the boundary and the value just below the lower boundary. And for the higher boundary as tested values, we identify the values at the boundary and the value just above the higher boundary as tested valued.
So the boundary between invalid too low and valid gives the test values 19 and 20 and the boundary between valid and invalid too high provides the tests with value 50 and 51. Some variations of this technique identify three boundary values bear boundary, where for each boundary we identify the value at the boundary and the value just before the boundary and after the lower of the boundary. In the previous example, using three point boundary values for the valid partition, the lower boundary test values are 1920 and 21 and the above boundary test values are 49, 50 and 51. In the exam, they will state it clearly if they want you to calculate the test values using three point boundary value analysis. If they didn’t indicate which technique to use, then consider two value boundary value analysis. So to solve the boundary value analysis questions right, you must identify the partitions correctly and identify the boundaries of each partition. Your test cases should use the exact boundaries you have just identified. Boundary value analysis can be applied at all test levels.
This technique is generally used to test requirements that call for a range of numbers, including dates, and times. Boundary coverage for about ten is measured as the number of boundary value tested divided by the total number of identified boundary test values generally expressed as a percentage. So considering two point boundary value analysis in our MBA example we agreed that we have the following boundaries 00:19 2050, 51 so we have five boundaries.
If the testers decided to consider three boundaries only in these design test cases, then the coverage would be three divided by five multiplied by 100 equals 60%. Let’s look at a more complicated boundary value and as an example to confirm our understanding, again, you need to be very careful with the wording of the question. All what we need to do is define the partitions correctly with its boundaries. The question didn’t specify if we should use two point boundary value analysis or three point boundary value analysis. So we can consider two point boundary value analysis safely.
So looking at the question, bank fee is 0% for balance less than $500. What will be the boundaries of this partition? Yes, we will start from zero but what will be the higher boundary in this partition? Notice that it says here less than $500. So in that case $499 or to be more accurate, $499. 99 will be the higher boundary for this partition. Again, warnings are the tricky part in these kind of questions. So from zero to 499. 99 we will have 0% bank fee. The following partition we will start from $500 and again looking at the question we will pay 2% for less than $1,000. So what will be the above boundary for this partition? Yes, it will be $999. 99. So the second partition will be from 500 to 999. 99. The following partition is from 1000 or more. So from 1000 up to infinity we will pay 4% bank fee. Looking at the question itself, what are they actually looking for? They are looking for valid boundary analysis. So we are just defining the valid boundaries here. So we have three partitions from zero to 499. 99 and the second one from 500 to 999. 99 and the third partition from 1000 to infinity.
So which choice is ours? Actually, this is the simplest part of boundary value analysis questions. Once you have defined the rotations correctly and the boundaries precisely then the answer is just in front of your eyes right now. For valid boundary value analysis I will just say without looking at any of the choices it will be zero, 499. 99, 500, 999. 99 and 1000. The numbers that you wrote with your own hands are the correct choice. So looking at the answer options, we can simply discard choice C because it contains a negative value and we are looking only for valid boundary values. Choice D seems very small, it doesn’t contain any 499 values. So we can also discard the choice D from our list. Looking at choice A we notice that it has many test inputs 0. 1, 499. 99 and so on. So choice A is not correct. When we were driving our test cases, we use the two point boundary value analysis technique. Is there a question? Ask it. For three point boundary value analysis, the answer would be choice A.
But a choice A is there to confuse you. So remember, they usually ask exactly if they want three point value. Actually, like let’s be more clear here. If we examined choice B and it turned out to be incorrect as well, then we can make a choice A here. So even though they haven’t directly asked it for three point boundary value analysis, but if the only correct answer was the three point boundary value analysis values, then be it. We will not pick long values anyway. So I hope this is clear, saying that looking at the values of a choice B zero, yes, 499. 99, yes, 500, 999. 99 and 1000. So after examining the values of a choice B, the correct answer would be choice B. Again, those kind of questions are very tricky in the wording. So we have to be very relaxed while reading the words. Use your pencil or pen or whatever just to go through that question word by word and draw. The bar is as I did and the numbers will just pop up in front of your eyes very smoothly. I hope you get the idea of those kinds of questions.