开发者

Retroactivly apply TDD to ASP.Net webforms

With an exi开发者_高级运维sting n-tier web application using ASP.net WebForms what is the best approach to get TDD acceptance on the application. What is a good plan to gain acceptance by developers to move forward to write test first code opposed to ignoring the tests while the TDD implementation is in limbo?

Knowing there will be a large "in-limbo" time of low coverage: What areas of the model do you start writing tests for first? Critical use areas, or new development?


I agree with womp, unit testing and WebForms is hard. Especially if most of your logic is embedded in the code behind files.

I have found it helpful to create functional tests first using something like Selenium. With some decent functional test coverage I can then start refactoring, adding unit tests as I go.


ASP.Net webforms is notoriously hard to build unit tests for due to the built in dependencies on static HttpApplication and HttpContext objects, and the leaky abstraction of the Page lifecycle.

That being said, it's always much much easier to start writing tests for new code, rather than spending any time going back and covering old code. Old code will need to be refactored heavily to allow for proper testing.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜