Making sure a view exists

前端 未结 5 1103
执念已碎
执念已碎 2021-02-06 09:37

I\'m currently looking into unit testing for a new application I have to create. I\'ve got the basic testing going nicely (testing the ActionResult classes is pretty nice). One

5条回答
  •  滥情空心
    2021-02-06 10:29

    I totally agree with Jason, but I don't think what you are trying to do actually contributes to test coverage. After all, rendering it and testing behavior will already cover whether or not it exists.

    Lots of developers go overboard when they first get bitten by the test-driven development bug. They want test failures to tell them exactly what is wrong so they don't have to dig in and debug. That isn't the primary purpose of testing; testing is for verifying correct behavior so you don't ship bad software. When something is wrong, then you can debug. There's no need to have a test harness so specific that the testing engine knows exactly what the issue is.

提交回复
热议问题