Testing ASP.NET Web Form Applications

If you are in my position, you have great WebForms applications that have grown to this overwhelming thing. Things break when you add new features and you need an inexpensive supported way to do some kind of automated testing.

Now, from my point of view, the right task is to try to create the page abstraction scheme and user management model present in ASP.NET WebForms, however, seeing that this will require large investments in an existing application, this is not an option.

I try and try to activate REST development as much as possible, because it has good properties. And by doing this, I wrote a simple spider robot that scans all the URLs that it can find and tries, just by getting them. This allowed me to quickly find bad data that caused problems and did not allow my end users to click on broken things, but this, of course, is not enough.

I continued to work on my scanner, and it turned into a simple REST client that tries a different combination of input, looks for a possible error or failure. This is more intelligent than just an exhaustive search (because it knows about the ASP.NET WebForms application layer), and my goal here is to basically examine the state of the web application, hoping to hit all the corner cases in front of our users.

Does anyone have experience doing something similar?

In addition, a guru is being tested for you. Is it a complete waste of time, or can I really say something about quality here? From my point of view, it seems that he got into a sweet place, because he will try something to the potential end user, although the browser.

As I said, we are stuck in a bad place. And now we need a simple way.

We tried things like Selenium, but it requires a lot of extra work, and we change things all the time, it is simply impossible to support several tests for testing selenium for 50 different applications.

+6
rest testing webforms
source share
3 answers

Of all the types of testing that you need to implement, unit testing is the simplest and most likely the result, in terms of smaller errors and more convenient code. Get what was designed before you do automated integration testing

  • Choose an IOC container - I like Ninject for this personally
  • Find a convenient place to enter the โ€œserviceโ€ classes on your page (constant of the base class of the page or redefine the module that loads the pages, whatever works for you)
  • Select the unit test structure, and if you do not have an automatic assembly, install it; include the launch of a complete set of unit tests in this assembly
  • Each time you approach a piece of logic in an aspx.cs file, see if you can isolate it in the service and wrap the object tests around it.
  • See if the MVP template suits you - we found that it reduced performance, how much it increased testability (it did a lot), but it works for some people.
  • See how to slowly port your application to MVC, page if necessary

And remember that you are not going to fix this problem in one night, you do not have time. Just keep improving your test coverage and you will see benefits over time.

+4
source share

What part of your application breaks down? User Interface or Business Logic?

Business logic should be completely separate from the user interface and should be tested separately. In particular, it is much easier to use automated tools for testing blocks in relation to shared business logic than against the user interface.

+1
source share

If I'm tired, you have a large web form and you want to run standard end-user tests every time you make a new version.

I can recommend Selenium IDE adon for firefox .

it will allow you to record your user actions, for example, fill out a form and allow you to reproduce these actions at any time. an easy way to run some form test with different data.

For internal code testing, write some unit tests using NUnit

0
source share

All Articles