3

Is there any way to use equivalence partitioning to write test cases for achieving coverage for testing an alphabet(English alphabet for example)?

Mostly when we speak about EP the first thing that comes to mind is numbers, but in real life, we can have names, car number plates, cities, special characters, etc.

So the idea is how can we achieve coverage by using EP for the alphabet, is there any way? Or this technique is only meant for number input fields and that's all?

2 Answers 2

2

Short answer is NO.

  • EP is not applicable to specific type of data format like numbers or alphabets/name

  • Equivalence Partitioning :

    1. In this technique, input data units are divided into equivalent partitions that can be used to derive test cases which reduces time required for testing because of small number of test cases.

    2. Each and every condition of particular partition (group) works as same as other.

    3. If a condition in a partition is valid, other conditions are valid too. If a condition in a partition is invalid, other conditions are invalid too.

    4. First thing come into mind for EP is numbers for you is valid because its easy to make partition (group) and numbers are easy to compare

    5. But its not mandatory to use numbers only. You can take car number plates, cities for that matter

    6. Example - For car registration, you can define number plate as <"state_name" "state_code" "actual_number"> i.e. TX 21 3205 (TX for Texas which has state code 21 and valid number with 4 digit)

    7. Car number plate with number "TXG 21 3205" would be invalid. Immediately you can identify because you are well aware this is not from any group or partitioning from US states. They have defined state_name should be mentioned in two alphabets only but it has three

2
  • 1
    Totally agree with the answer. My short answer is -- for eg alphabet consists of 33 unique characters so covering one will not give you coverage for any other character from the alphabet. I raised this question cause I've been asked during an interview by a well-honored person, even though I answered to question with some ideas and got the offer still left with the state that I don't know exactly, thank you for the answer
    – llRub3Nll
    Feb 2 at 11:37
  • You did great concluding in interview. All the best for new role :) Feb 2 at 13:02
3

Yes, equivalence partitioning can be applied to test alphabets or characters as well. The idea behind equivalence partitioning is to divide the input space into a finite number of partitions and to test one representative from each partition.

For testing an alphabet input field, you can divide the input space into several equivalence classes such as:

  1. Uppercase alphabet
  2. Lowercase alphabet
  3. Special characters
  4. Combination of uppercase and lowercase alphabets
  5. Combination of alphabets and special characters
  6. Length of input (minimum, maximum and within limits)
  7. Leading and trailing spaces
  8. Empty input

By testing one representative from each of these equivalence classes, you can achieve coverage for the input field.

1
  • I agree with the statement but as you have written in the last sentence, by doing this you can achieve coverage for the input field. My question not about coverage for field but exactly the alphabet, sop by dividing to lower and upper cases for example we can;t achieve any coverage for the alphabet characters. the question is only about the alphabet. But as I already say, I totally agree with the answer in case we want to cover a field which accept inputs.
    – llRub3Nll
    Feb 3 at 6:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.