Transcript for:
Blackbox Test Design Techniques: Equivalence Partitioning and Boundary Value Analysis

hello everyone welcome to part one of session three of module 4 specification based or blackbox test design techniques so in part one of session three we will learn about following specification based or blackbox test design techniques what techniques we will learn in this part one we will learn about equivalence partitioning and Boundary value analysis so let's get started so let's first understand what is equivalence partitioning equivalence partitioning is a blackbox test design technique it can be applied at all levels of testing so equivalence partitioning can be applied at all levels at the unit testing level at the integration testing level at system testing level um so at all the levels of testing um you can apply equivalent partitioning to design your test cases so unit integration system acceptance at any level of uh testing this technique this blackbox technique can be applied to design your test cases then what is the idea behind equivalence partitioning is to divide or to partition a group of test conditions um into a set that is considered Same by the software okay so Suppose there is a text field in a web page in your web web based application which accepts some range of numbers some range will start from some valid number and end from some uh and at some valid number okay so suppose it accepts just numbers from 1 till 100 so as the name equivalence partitioning is pretty self-explanatory so since your software the text field in the software accepts a range of some numbers from 1 to 100 so this range of between 1 to 100 is a valid partition so you partition uh you design your test cases in such a way by par in um the valid and invalid partition so the that text field will accept the numbers between 1 to 100 and there will be two invalid partitions for the text text field one will be anything less than one and the other invalid partition will be anything greater than 100 so that's the fair bit of idea um how equivalence partitioning is done and how you do it and how you design your test cases by using equivalence partition we we'll take more examples as we go ahead so we need to uh test just one condition from that partition as it is assumed that all the values in that partition will be treated in same way so in that valid and invalid partition you need to just test one value from those partitions because it it's assumed that all the values in those partitions will be treated in a similar way so that's the idea behind equivalence partion rather than just testing um randomly uh the the inputs randomly it's always a good idea to test invalid partition valid values from invalid partition valid partition and invalid partition so so that way it's you you have a better coverage of the software you cover a lot more partitions rather than doing a random test of input doing uh of making an input of any number in the text field then if one of the value in a partition will work then we assume that all values in that partition will work that's that's the idea behind equivalence partitioning and if one of the value in that that partition fails then it is assumed that all the values in that partition will fail then these conditions may not always be true however testers can use better partitions and also test some more conditions within those partitions to confirm that the selection of that partition is fine so this is not hard and fast thing that you should always test one value in in one partition um so there has to be a mix and match and you should design your partitions in such a way uh that you are covering almost all the partitions and then you should also try more values within those partitions and make sure that everything is fine then equivalence partitions are also known as equivalence class so if somebody asks you what is equivalence class it is same as equivalent partitions so let's take an example of equivalence partitioning so suppose um there is a store uh e-commerce website um which offers different discounts on different purchase amounts so if the purchase amount is in the range of $0 up to $50 so and I have taken um the dollar amount up to two digits um so um so it's 0. to 50. so two decimal up to two decimal places uh and if the purchase amount is over $50 and up to $200 the discount percentage is 5% if the purchase amount is over $200 and up to $500 discount percentage is 10% if purchase amount is um above $500 and up to a maximum so there there is a maximum limit defined as well um purchase limit so the discount will be 15% so now you have separate um purchase amounts which which is kind of a range of the purchase amount purchase um uh the amount of the dollars you spent and then there is a discount percentage so now using equivalence partitioning if you want to um design your test cases you can easily create the partitions and you will be able to figure out what values you want to test in those um in in these scenarios rather than just randomly um inputting any purchase value and verifying the discount which is not the right approach so the right approach is to design your test cases using equivalent partitioning properly and then test each valid and invalid partition so we have seen that if purchase the the second line um on this page if the purchase is in the range of0 up to $50 then there are no discount so first partition you can think of is um the purchase amount will start from $0 so 0. up to $50 so $50. um so that's that's one valid partition where wherein you will get no discounts all right then the second partition will start from um 50.01 so that's another partition for which you will get 5% discount so 50.01 as we have taken two decimal places so 50.01 any purchase which starts from 50.01 up to $200 will be in the valid partition of 5% discount then there will be a partition of 10% discount that is also valid partition which will have the range of 2001 to $500 so that will be 10% discount then another valid partition is for the 15% discount so valid partition 15% discount which is for the purchase of $500 uh Dollar Plus up to maximum limit uh maximum purchase limit so 500.1 up to maximum purchase limit so these are four valid partitions no discounts 5% discount 10% discount and 15% discount so any p is above um maximum is not allowed that means that is an invalid partition all right and any purchase below 0 any negative value is not allowed and that is also a invalid partition so you have four valid partitions and two invalid partitions in this case so this applying equivalence partitioning in this scenario made your task very easy so now you can test some values in this invalid partition in negative um negative you can try you can check the negative what's the outcome when you enter any negative purchase amount what's the outcome when you um enter any valid partition which is which is less than $50 or up to $50 you should get no discounts and for 5% discount if you enter any value between 50 and 200 you should get 5% discount if you enter any value between 200 to 500 you should get um 10% discount and if you enter any value between 500 and less than maximum you should get 15% discount and any any purchase above five above maximum plus um 0.01 should again be um treated as in invalid and it should be handled properly uh by the e-commerce website or the portal that you are testing so this is um one example of equivalence partitioning how you do equivalence partitioning for any application so the next um technique that we'll discuss is the boundary value analysis so as equivalence partitioning was testing valid and invalid partitions now boundary value analysis is any input or output value on the edge of an equivalence partition so in equivalence partition we have seen an example that from $0 to $50 there was there was no discount so what boundary value analysis is boundary value analysis checks the behavior of the software when you enter input or output when you when you check input or output at the edge of the partition so suppose the valid partition was 0 to $50 0. 250. so the boundary values for that valid partitions will be 0. to and um 50. so so these are two boundary values for that valid partitions so boundary value is any input or output value on the edge of the equivalence partition boundary value analysis is based on testing at the boundaries between partitions so boundary value analysis is um based on testing at the boundaries it's it it has nothing to do with um the values between uh the valid and invalid partition it's it just tests the values at the boundaries and Boundary value analysis is a blackbox test design technique where test cases are designed by using boundary values and bva is used in um Range checking uh to apply boundary value analysis you need to take maximum and minimum values from valid partitions so as we um saw in the previous example the valid partition first valid partition was 0 .250 so you need to take Max maximum and minimum values from valid partition so minimum and maximum value from first valid partition were 0.0 and maximum was $50. and together with first or last value respectively in each of the invalid partition adjacent to the valid partition so so if if the if the text field on your web page accepts values um between 1 to 100 so boundary value analysis will take tests as so the first value will be minimum value is 1 maximum value is 100 and the and then first and last value from invalid partition so invalid partition would be any any value above 100 so the last value above 100 is in the invalid partition is 101 and the first value in the in the invalid partition adjacent to the valid partition is zero so in this case where in your text box accepts value between 1 to 100 you'll be having 0 1 100 and 10 1001 as your boundary values so let's let's take an example to understand this better so suppose you have a text field as we discussed uh we we discussed about 1 12 100 now on the web page we uh in in this example I have taken um up to 1 1 to 1,000 so if a text Felix cepts values between 1 to 1,000 so the valid partition will be 1 to 1,000 all right and the invalid partition will be anything less than one okay so it will be zero since it just accepts the integer value so it will be anything less than one is integer value is um zero and integer value above th000 is 100 uh, 1 and above and that is all also invalid because the taex field accepts only between 1 to 1,000 so boundary value for this example would be 0 1 1,000 and 1,1 so in in the previous uh slide we have seen that minimum and maximum of valid partition and then first and last value resp respectively in each of the invalid partition adjacent to the valid partition so the first and last value in each invalid partition so first value in the invalid partition is um is is is this uh this is the first value in the invalid partition and that's the the kind of um zero is another value in the invalid partition so 0 1 1,00 and 1,1 are the values that you can test in boundary value analysis so let's take another example to understand boundary value analysis so we have taken up the same example as we discussed um previously for equivalent partitioning so I store in C of offers different different discounts depending on the purchase amount so if purchase is in the range of $0 to $50 no discount so it's exactly the same uh same example so we have seen that valid partitions were uh for the no discount 5% discount 10% discount and 15% discount and invalid partition was anything above maximum purchase limit or anything in the negative as a negative purchase was the invalid partition so now we'll see what are the boundary values for this scenario so boundary values will be for this partition the boundary values will be $0 and the maximum in this Bound in this um equivalence partition is $50 for this partition 5% partition the boundary value will be 50.01 one anything above this and the other boundary value will be 200 all right so let's let's see what all boundary values will be there for four valid partitions and two invalid partitions in this case so here if you see um so the test condition is first is the purchase amount and discount purchase uh percentage so these are the test conditions so we have seen that there are four valid partitions first valid partition was between 0 to 50 wherein no discounts were offered another valid paration was between 50 to 200 wherein 5% discounts were being offered third valid paration was between $200 and $500 for which 10% discounts were offered and the last valid partion was between $500 and up to maximum purchase limit for which 15% discounts were offered and the invalid partitions were anything less than $0 all right or anything greater than the maximum purchase limit so these were two invalid partitions and discount percentage what will be the discount um percentage invalid um partition any other value you can say or non- integer or non-interest calcul cated so anything other than these discounts is invalid partition for uh discount percentage so let's see what will be the valid boundaries so valid boundaries first and last value of first par first valid partition so zero and 50 then another uh valid boundaries for another partition first and last value of another partition so 50.01 and 200 then for third partition valid partition boundary values will be 200.1 and 500 and then for the last valid partition 500.1 and maximum purchase amount so these are the valid boundaries so 1 2 3 4 5 6 7 8 so eight boundaries you will get for four valid partitions and what will be the invalid valid boundaries anything less than 0 so you can say 0 point um 0 1 all right or negative value um and anything above maximum plus 0.01 so these are two invalid partitions so what you can say is um so in this case you need to test these eight values for for your for this scenario of discount in a store and two invalid boundaries to make sure that error handling is done properly for any invalid boundaries and for any valid boundaries and partitions your discounts are being calculated perfectly fine all right because it is seen that most of the software um break at the boundary uh at the boundary values so that is why um you should always test boundary values as well as sum of the values in between those boundaries so apart from these 10 test cases you should also test some of the values between these valid partitions to make sure that everything all other um scenarios are perfectly fine so the advantage of doing equivalence partitioning and Boundary value analysis is that it is a structured approach and it makes your test design much more efficient and easier and you are almost covering every possible um partitions and Boundary values that are possible in that particular scenario so why to do both equivalence partitioning and Boundary value analysis so equivalence partitioning and Boundary value analysis exist together whenever you are working um in an ENT Enterprise um uh application testing or in any testing organization you you do not do just equivalence partitioning or boundary value analysis you do both of them together and they are always done together it's because testing only boundaries does not give much confidence as we are just testing as we are testing just extreme values of the partitions so if you're just doing one thing uh if you're just doing equivalence partitioning and checking few values in between randomly and not checking the boundaries or you are just checking the boundaries and not the values in between of the valid and invalid partition so that's that does not give you the complete confidence so that is why both equivalence partitioning and Boundary values are very important they are done together it is important to test some values in between the partitions as well so that is why it's not only um just test extreme values but some values in the partitions so it is recommended that partitions should be tested separately from boundary values and it is always recommended that partition should be tested separately from boundary values and if you want to be more thorough then start with valid partition testing then invalid partition then valid boundaries and finally invalid boundaries so both equivalence partitioning and Boundary value analysis has to be done together and you you should start with uh valid partition uh invalid partition and valid boundaries and invalid boundaries so every all your test cases should have both techniques covered in order to make sure that you are covering um all aspects of the um of equivalence partitioning and bound R Val analysis and testing um the software properly with with these techniques so to conclude um in this session we'll learn about specification based or blackbox test design techniques we learn about equivalence partitioning and Boundary value value analysis and we also under understood why we need to use both equivalence partitioning and Boundary value analysis together to design our test case and how these techniques will reduce your extra um effort that you put while you are doing random testing if you just input any values randomly um to test these kind of scenarios it's not sure that you are covering all the partitions and all all the boundary values unless you apply these techniques you are not sure that you have covered all the partitions and all the boundary values so it is very important when you start designing your blackbox testing uh test cases you apply these techniques in order to make sure that you are covering both um test design techniques for designing your test cases thank you