Should I write unit test for everything?

前端 未结 13 1525
太阳男子
太阳男子 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:08

    Designing tests is an acquired skill - the more you test the better at it you get. Some things appear hard to test but if you think about it for a few minutes you can often find a way.

    Tests can be messy - e.g. a java program can launch an interpreter or even a shell such as bash which in turn launches a series of unix filters which you hope will output identical binary files. Don't worry though - the quality of test code does not have to be as high as the code in the finished product.

提交回复
热议问题