Should I unit-test with data that should not be passed in a function (invalid input)?

后端 未结 7 1168
执笔经年
执笔经年 2021-01-17 22:20

I am trying to use TDD for my coding practice. I would like to ask should I test with a data that should not happen in a function BUT this data may possibly break your progr

7条回答
  •  别那么骄傲
    2021-01-17 22:55

    If other code guards against calling that method incorrectly, and no one else will be writing code to call that method, then I don't see a reason to test with invalid values. To me, it would seem a waste of time.

提交回复
热议问题