开发者

Write Unit Test for a legacy asp.net web application

开发者 https://www.devze.com 2023-03-17 14:26 出处:网络
We have a huge web application that has been written in .net 1.1 and 2.0. Althought it is currently running into .net3.5 all architeture is \"old\" and messy. We may find business logic into ajax and

We have a huge web application that has been written in .net 1.1 and 2.0. Althought it is currently running into .net3.5 all architeture is "old" and messy. We may find business logic into ajax and java script until the data layer.

Now the managers had decided that they want to start to unit test the app.

Does anyone have an idea or knows where I find a material to start or even to dec开发者_开发知识库ide if there is a worth to start?


This is a repeat answer from a similar question.

Typically, it is very difficult to retrofit an untested codebase to have unit tests. There will be a high degree of coupling and getting unit tests to run will be a bigger time sink than the returns you'll get. I recommend the following:

  • Get at least one copy of Working Effectively With Legacy Code by Michael Feathers and go through it together with people on the team. It deals with this exact issue.
  • Enforce a rigorous unit testing (preferably TDD) policy on all new code that gets written. This will ensure new code doesn't become legacy code and getting new code to be tested will drive refactoring of the old code for testability.
  • If you have the time (which you probably won't), write a few key focused integration tests over critical paths of your system. This is a good sanity check that the refactoring you're doing in step #2 isn't breaking core functionality.
0

精彩评论

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