How do I start unit testing?

后端 未结 8 998
盖世英雄少女心
盖世英雄少女心 2020-12-15 12:48

I know that unit testing is desirable, and I am interested in doing unit testing. The only problem is I have no idea how, or even where to start really. So my question is:

8条回答
  •  有刺的猬
    2020-12-15 13:29

    I would recommend reading Michael Feathers' "Working Effectively with Legacy Code". Old code often ends up being code that's hard to Unit Test. Feathers' book is a great guide in how to refactor your code to the point that unit tests are a snap to write.

    Not exactly an answer to the question you asked, but might be a missing step between where you are, and where you need to be to implement some of the answers others have given.

提交回复
热议问题