Equivalence Class Testing vs. Boundary Value Testing

限于喜欢 提交于 2019-12-29 02:47:07

问题


I understand how equivalence testing works.

How is it the same or different from boundary value testing?


回答1:


Equivalence Class Testing
EC Testing is when you have a number of test items (e.g. values) that you want to test but because of cost (time/money) you do not have time to test them all. Therefore you group the test item into class where all items in each class are suppose to behave exactly the same. The theory is that you only need to test one of each item to make sure the system works.
Example 1
Children under 2 ride the bus for free. Young people pay $10, Adults $15 and Senior Citizen pay $5.
Classes:
Price:0 -> Age:0-1
Price:10 -> Age:2-14
Price:15 -> Age:15-64
Price:5 -> Age:65-infinity

Example 2 (more than one parameter)
Cellphones K80, J64 and J54 run Java 5. K90 and J99 run Java 6. But there are two possible browsers FireFox and Opera, J models run FF and K models run O.
Classes:
Browser:FF, Java:5 -> Phones:J64,J54
Browser:FF, Java:6 -> Phones:J99
Browser:O, Java:5 -> Phones:K80
Browser:O, Java:6 -> Phones:K90

Dangers Of Equivalence Class Testing
There is a danger of using EC Testing that is rarely mentioned in the testing books but is very important to remember.
Just because two items/values are suppose to be in the same class and behave the same, does not mean they DO behave the same.
That means that just because you test one value in the class that ALL values in the class behave the same. Real world example of mine is with cell phones that all had a certain Java Platform. They were suppose to all work the same but they didn't in reality. So testing just one value in a class is good, but not good enough. EC Testing is a good tool, but it's not fool proof and be careful with it. If test cases are cheap and fast (like automation), test more, or why not test them all!

Boundary Value Testing
BV Testing is when you decide to test the values on the edge of each Class you have identified. The theory is that most defects is around the edges of a class. Example
Classes:
Price:0 -> Age:0-1 ( Boundary values 0, 1)
Price:10 -> Age:2-14 ( Boundary values 2, 14)
Price:15 -> Age:15-64 ( Boundary values 15, 64)
Price:5 -> Age:65-infinity ( Boundary values 65)

Critique of Boundary Value Testing
1) I, and other test professionals I have taken courses from, are not convinced that most defects are hidden around the edges of each class. And I have never seen any studies that proves this to be the case. 2) The fact that you need to use BV Testing proves that EC Testing is flawed since you test more than one value of each class. 3) It's easy to use when using values like integers. But what is a boundary value of class of phones models or browsers versions?

Hidden Boundary Value Testing
The boundary values of a class is often based on the specification of how the system should work. This is all good and well but most systems contain boundaries that are not explained in any spec and you will need to look for yourself. E.g. 'How many characters can I put into the test field before the system fails and breaks.','How big can the data file become before it so slow to read it gets annoying'.
Real world examples
- Pasting one million characters into a text area in FireFox 3.5 on win 7 crashes it
- ReCaptcha has a limit of 16003 characters, does your system handle the 413 that it passes back to it if somebody puts 16004+ characters in field. Or does it break

Summary
EC Testing and BV Testing are great tools and you should use them but they are not perfect and don't expect to find all defects using them. Use your know-how about the system and your intelligence and intuition to try more items and looks for other ways it could fail. And look for the hidden boundaries!




回答2:


Boundary value analysis simply means to select values near the boundaries of the classes. So you are still dividing the input domain according to the classes then instead of selecting values from the middle of the class use values from the boundaries.

For example, if the input condition is a range from 20 to 70 then you have three classes of input

  1. less than 20
  2. between 20 and 70
  3. more than 70

then for boundary value analysis select input = 19, 20, 21, 69, 70, 71. This type of analysis picks up errors on the boundaries.




回答3:


The Equivalence testing needs to be supplemented with the Boundary value testing.

For example for equivalent testing of a function that takes values between 1 and 12
(say months of a year) the partitions would be:

  • values less than 1 (0,-1,-2), invalid partition
  • values between 1-12, valid partition
  • values greater than 12,invalid partition
  • For equivalence testing it is enough to pick one value as test input from each of these partition classes. That would mean tests with value of -2,6, and 15 would be considered enough to test behavior of the function. But these values doesn't catch Off-by-one error which can occur quite often.

    With the boundary value testing the test inputs would be : -1,0,1,11,12,13 (at the boundaries), which would catch off-by-one errors.

    I see both these testing methods to be a complement of each other.




    回答4:


    Boundary value analysis is part or subset of equivalence partitioning. In boundary values analysis, instead of some random value, only values in the boundary are selected.




    回答5:


    Boundary value analysis overcome the drawback of the Equivalance class partitioning. If a fix length is g9iven for eg. Mobile number (10 digit.)

    The lower boundary in this case is - digit - 1 (ie. 10 - 1 =9) The upper boundary in this case is - digit +1 (ie 10 + 1 =11)

    Now we can perform test for the 9 and 11




    回答6:


    Dynamic Testing Types –

    1. Specification Based testing

      A. Equivalance Partitioning

        A1. Boundary value analysis
      
        A2. Decision Tables
      
        A3. Use case Testing
      
        A4. State Transition testing
      
    2. Structural Based testing

      A. Test Coverage

      B. Code coverage

      C. Statement coverage

      D. Decision coverage

    3. Experience Based Testing

      A. Error testing

      B. Exploratory Testing

    Equivalance Partitioning – It is a technique where tester divide the test conditions into groups and sets. System should handle them equivalently hence called equivalence classes. To test one condition from each partition will work to assume all condition will work in that partition.

    EX >> Check addition of the single digit values. i.e. values between 0 and 9.

    1. Values less than -9, i.e. -10,-11, …. (Invalid partition)

    2. Values less than 0, i.e. -1,-2, …. till -9 (Valid Partition)

    3. Values between 0-9 i.e. 0,1 …. till 9 (Valid Partition)

    4. Values greater than 9, i.e. 10,11 (Invalid partition)

    Testing the addition for any two values of each partition is enough.

    Boundary value testing – It is based on testing at the boundaries between partition.

    EX >> Consider below combination.

    1. Addition of -9 and -10,

    2. Addition of -10 and -11

    3. Addition of 0 and -1

    4. Addition of 0 and 1

    5. Addition of 9 and 10

    6. Addition of 11 and 10



    来源:https://stackoverflow.com/questions/1909280/equivalence-class-testing-vs-boundary-value-testing

    易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
    该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!