ASP.NET MVC - Unit testing overkill? (TDD)

前端 未结 5 1176
误落风尘
误落风尘 2021-02-04 05:08

So I\'m starting to catch the TDD bug but I\'m wondering if I\'m really doing it right... I seem to be writing A LOT of tests.

The more tests the better

5条回答
  •  南笙
    南笙 (楼主)
    2021-02-04 05:30

    100% coverage is very ideal, its really helpful if you have to massively refactor your code however, as the tests will govern your code specs to make sure it is correct.

    I am personally not a 100% TDD (sometimes too lazy too) but if you intend to do 100%, maybe you should write some test helpers to take away some burden on these repetitive tests. For example, write a helper to test all your CRUD in a standard post structure with a callback to allow you pass in some evaluation might save you a lot of time.

提交回复
热议问题