mardi 26 janvier 2016

Do I have to unit test every value a parameter could take?

For example, if I have a method that execute simple logic and take an int parameter in input, do I have to unit test cases when input is :

  • a good int (like 1)
  • a bad int (like 822873873824676372732367232637233)
  • a descent float
  • a bad float
  • a bool
  • a string
  • no parameter

Well I think I already know the answer, but where is the limit?

Also, when the method have A and B parameters, do I have to test every cases that could happens for A? for B? for A and B?

Aucun commentaire:

Enregistrer un commentaire