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

后端 未结 7 1170
执笔经年
执笔经年 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 23:14

    You said your method will raise an exception if the argument is not valid.

    So, yes you should, because you should test that the exception gets raised.

    0 讨论(0)
提交回复
热议问题