-2

I have task to build equivalence classes, and boundary values based on given information

To calculate the electricity cost user should enter an old and a new values of electricity counter and press “Calc” button. It works only if values are entered correctly:

  • contain only digits;
  • no longer than 6 digits;
  • new value is not less than an old one;

I did this task, but i don't know if i did it right It would be great to get feedback

My equivalence classes, and boundary values table

Update Update

2

What you've done is not precisely wrong, but it could be better.

I'd express the data this way:

Valid: 0 >= OldNumber >= NewNumber > 999999

  • OldNumber minimum value = 0
  • NewNumber minimum = 0
  • OldNumber max = 999999
  • NewNumber max = 999999

Invalid: OldNumber or NewNumber is not a number

Invalid: OldNumber or NewNumber < 0

That said, there isn't enough information in your instructions to fully define valid/invalid values

It works only if values are entered correctly:

contain only digits;
no longer than 6 digits;
new value is not less than an old one;

Missing information:

  • whether decimals are allowed
    • If decimals are allowed, how many decimal places
  • whether "not less than" means that the new value can be the same as the old one
  • whether either value can be null/empty

You've made assumptions about these conditions, but that does not necessarily mean that your assumptions are correct.

| improve this answer | |
  • I guess value can be null but why did you write that OldNumber minimum value = 0 and NewNumber minimum=0? If we speak about length, value should contains one digit minimum, because value cannot be empty – Yamis Dec 24 '19 at 15:32
  • @Yamis - if NewNumber can't be less than OldNumber, and OldNumber's lowest allowed value is 0, then NewNumber's lowest allowed value is also 0. If b must not be less than a, then the rule is b >= a – Kate Paulk Dec 24 '19 at 15:39
  • I am sorry if i don't understand but in this case OldNumber minimum value = 0 NewNumber minimum = 0 OldNumber max = 999999 NewNumber max = 999999 you speak about length of value. So old and new number should be minimum = 1 because value cant be empty – Yamis Dec 24 '19 at 15:55
  • @Yamis - 0 is not empty. 0 is a value, and one your question explicitly calls out as legitimate. – Kate Paulk Dec 24 '19 at 16:25
  • Maybe my English is very bad if you can't understand what i try to tell you. So condition no longer than 6 means that a value should have one or 6 digits(count of digits = 6 or less; Examples: 1, 242, 200000), so when user didn't write any digits in text box (count of digits <1, what means = 0) so text box is empty. It was first validation for length of value or for count of digits of a value. Second validation should verify is a value >=0. Anyway i have updated my table. Please check it out i would be glad:) – Yamis Dec 24 '19 at 16:44
1

I'll try to answer the question, but first a few thoughts about the question itself.

It mentions only one number, but in many cases, the electricity cost has to be calculated from two numbers depending on different rates you might get from your electricity supplier. If this is the case, you'd have a dual-rate/two-rate electricity meter that have two numbers, so then customers would probably need to enter two numbers for new value and two for old value. It might seem a bit too much to think about this in such an example, but if this was not a task from an exam/school etc., you'd need to think about it, so I'm trying to bring up such a way of thinking even here. In a real situation, you'd also need to come up with expected results for these classes and tested values.

The question doesn't explicitly mention the increment for BVA, but it probably assumes some basic knowledge of electricity meters (saying this, my previous paragraph seem even more valid) that usually don't take any decimal numbers into account when used for counting electricity cost.

Lastly, the question doesn't mention if you should do 2 or 3 value BVA. They will differ in the number of test cases you'll eventually get.

Now about the actual answer and what you've done.

Your partition for BVA is 1 - 100000, but if the condition is 6 digit number, 999999 would meet the condition just as well. Then I don't understand why you have concrete values in some cells, but a range in BVA. Do you want to test for all of these values? That wouldn't be necessary. So in my view, the BVA should look more like this:

range:tested values for 3 value BVA
(-inf., 0):-1, 0
<0, 999999>: 1, 999998, 999999
(999999, inf.): 1000000

So in terms of 3 value BVA, you test 6 values in total.

In terms of EP. You have outlined some partitions, you focused on negative partitions as well, which is necessary. I think we might be able to find out much more interesting test cases for an input field, but that already out of scope for this exercise. However, I'd personally try to at least think about the situation when only one of the pair new value, old value is valid. For example what about if new value is 1500000 and old value is 900. The condition of NV > OV is met, but not the condition of "max 6 digits", so it might be interesting to try out such cases in the real world.

| improve this answer | |
  • why do i need to use a range from 0 to 999999 instead 0 to 100000 or from 0 to 111111? There are 6 digits too. – Yamis Dec 24 '19 at 15:03
  • @Yamis Because that's how the range is defined in your example. Values 0 to 999999 have the same meaning in your example (see those 3 conditions you posted in your question), so you can't create your own range from 0 to 100000. – pavelsaman Dec 24 '19 at 15:11
  • Do you mean that after 999999, electricity counter will round value up to 1,000,000 (7 digits)? – Yamis Dec 24 '19 at 15:19
  • 1
    @Yamis: I have no idea what happens next, all information I have is from your initial question. You condition is "6 digit number", so you need to include maximum of 6 digits in your partitions, that's up to 999999. – pavelsaman Dec 24 '19 at 16:04
  • I have updated my table. Please check it out, i would be glad:) – Yamis Dec 24 '19 at 16:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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