How to start unit-test old and new code?

前端 未结 5 1951
谎友^
谎友^ 2021-02-05 09:43

I admit that I have almost none experience of unittesting. I did a try with DUnit a while ago but gave up because there was so many dependencies between classes in my applicatio

5条回答
  •  执念已碎
    2021-02-05 09:55

    One of the more popular approaches is to write the unit-tests as you modify the code. All new codes gets unit tests, and for any code you modify you first write its test, verify it, modify it, re-verify it, and then write/fix any tests that you need due to your modifications.

    One of the big advantages of having good unit test coverage is being able to verify that the changes you make don't inadvertently break something else. This approach allows you to do that, while focusing your efforts on your immediate needs.

    The alternate approach I've employed is to develop my unit tests via Co-Ops :)

提交回复
热议问题