Should I write unit test for everything?

前端 未结 13 1502
太阳男子
太阳男子 2020-12-30 00:36

I am wondering should I write unit test for everything. There are some classes is very difficult to write unit test. For example, I am writing some program for handling audi

13条回答
  •  天命终不由人
    2020-12-30 01:10

    I test most stuff.

    Whenever I write tests I also consider tests to be documentation or instructions on how my code should be used, for me and others to read in the future.

    I don't test implementation though. I want to be able to change the implementation without changing my tests.

    I have used TDD for maybe a year or two so maybe I will mature and stop. So far, though, I'm still learning and think that I don't write enough tests.

提交回复
热议问题