nus-cs2103-AY1920S1 / forum

Forum
1 stars 1 forks source link

Equivalence partition for string #195

Open andyylam opened 4 years ago

andyylam commented 4 years ago

image

I have a question regarding the equivalence partition of text in the above question. Currently, I have the following:

  1. Length longer than n
  2. Length shorter or equal to n
  3. Null
  4. Empty string

Firstly, is an empty string a partition, since it also falls under option 2? Secondly, are there any other partitions that should be considered?

damithc commented 4 years ago

The method is not supposed to behave differently based on the string contents. Therefore, it is not necessary to consider empty string as a separate partition. But when choosing values to test, one can include a string with leading/trailing spaces to catch a bug caused by an unwanted trim() method in the code. The other three partitions seem good enough.

andyylam commented 4 years ago

Thanks Prof! On a similar note, how much should we use boundary values in testing? For instance, if n (int) has valid values in range [0,10] and we are asked to create test cases in an effective and efficient manner, what values should be considered?

damithc commented 4 years ago

Depends on how many test cases we can afford. Then, start with the boundaries (e.g., 0, 10), and then add non-boundary values (e.g., 4) if there is room.