Testing ASP.NET webforms applications

后端 未结 3 691
伪装坚强ぢ
伪装坚强ぢ 2021-02-06 07:54

If you\'re in my position you have a big WebForms applications which have escalated to this unmaintainable thing. Things break when you add new features and you need an inexpens

相关标签:
3条回答
  • 2021-02-06 08:35

    What part of your application is breaking? The UI, or the business logic?

    Business logic should be completely separated from the user interface, and should be tested separately. In particular, it's much easier to use automated unit testing tools against separated business logic than it is against UI.

    0 讨论(0)
  • 2021-02-06 08:51

    If i am rigth you have a large web form and want to run some standard end user tests each time you do a new release.

    I can recomend the Selenium IDE adon for firefox.

    it will allow you to record your user actions, e.g filling in a form, and allow you to replay those actions at any time. an easy way to run some test over a form with differnt data.

    For internal code testing write some Unit tests using NUnit

    0 讨论(0)
  • 2021-02-06 08:57

    Of all the types of testing to implement, unit testing is both the easiest and the most likely to yield results, in terms of less bugs and more maintainable code. Get that worked out before you deal with automated integration testing

    1. Pick an IOC Container - I like Ninject for this personally
    2. Find a convenient place to inject "service" classes into your Page (the consturctor of a base Page class or override the module that loads pages, whatever works for you)
    3. Pick a unit test framework and if you don't have an automated build then set one up; include running a full suite of unit tests in that build
    4. Every time you go near a piece of logic in an aspx.cs file, see if you can't isolate it in a service and wrap unit tests around it
    5. Take a look at whether the MVP Pattern would be good for you - we found it decreased productivity as much as it increased testability (it did both a lot), but it works for some people
    6. See about slowly migrating your app over to MVC, a page at a time if necessary

    And remember, you are not going to fix this problem overnight, you don't have time. Just keep improving test coverage and you'll see the benefits over time.

    0 讨论(0)
提交回复
热议问题