Testing Asp.Net: not a black box testing anymore

First of all, I'd like to thank you. Since you are reading this, you are apparently interested in automating Asp.Net testing. By making your Web sites work properly, you are making our world better, and us, your users, happier.

You are probably looking for a tool that would help you writing these tests. It is widely known that testing Asp.Net sites is hard. Most probably your tests are slow, brittle, hard to write. Perhaps you don’t even write them because the effort is not worth it. Perhaps you put a lot of effort into squeezing every tiny piece of code out of the UI and into the middle layer, just to make it testable. Or you run your browser automated tests only once a day because it takes an hour and a half to finish (quite probably, with an obscure bug).

It does not have to be that hard

You just need a tool that makes it simple and fast. A tool that can help you write simple unit or integration tests without much effort, and run them just about as quick as your other tests.

I've been there too

I’ve been building Web sites on the .Net platform for over 9 years, and I've been on and off Web testing, because both ways were too painful. I started with NUnitAsp and was excited in the beginning, but later I discovered that I'm spending more time on supporting my tests than on writing the production code. I tried the browser-based tools and was frustrated by the brittleness of my tests and the inability to express the results in terms of the underlying object structure. Most of the time I didn't need to test my client-side code, but I needed to, say, verify that a particular Repeater contained three items, and didn't want to parse the HTML output in order to verify that.

It is out of this need that Ivonna has been born.

What's the difference

  • No Web server nor a Web browser is involved. You run your tests in-process. No HTTP overhead, no unwanted UI popping up.
  • You deal with actual server-side objects. You don’t just look at your HTML output and guess what happened on the server; you examine the actual objects, such as System.Web.UI.Page, or even HttpContext.
  • You can stub/mock things. Prevent a mail message from being sent, or an external service from being called, yet verify all relevant calls.
  • You can modify configuration values on the fly, or even use a different config file.

Here’s how it works

Unlike other testing tools, Ivonna is not a "client-side" tool. It doesn't just test the HTML output (although such a possibility exists), it creates and executes an Asp.Net request and allows you to examine the intrinsic objects, such as the Page object. This opens many new possibilities, such as

  • Examining properties of page controls and other objects, such as the HttpContext object.
  • Testing UserControls in isolation.
  • Mocking external dependencies in order to isolate the page behavior.
  • Injecting setup code and assertions into the page's lifecycle event handlers.
  • Setting test-specific configuration values, or using a different configuration file.
  • Executing Web Service and Page Method calls and verifying the UpdatePanel functionality.

Wait, what about Asp.Net MVC?

The 3.0 version brought transparency to Asp.Net MVC integration testing. As always with Ivonna, you can mock external dependencies and change configuration parameters easily. In addition, you can "peek" inside the process -- the response object contains references to all important objects related to the MVC framework. That's right -- this is not a black box testing anymore. You now can write expectations against the following guys:

  • Controller name
  • Action method name
  • Action method parameters
  • View instance
  • Model instance

See the sample page for the, you guessed it, samples.

Other frameworks are supported too. If you're an alpha geek like me, and you love playing with not-so-common frameworks, Ivonna can help you too. You can use all of her generic features, or you can write your own extension and deal with the framework specifics.

Fine, now tell me what I can't do with it

You cannot test your client side code. That's not what Ivonna has been created for.

There are some other minor limitations that might be removed when there's demand for it, but they are too minor to be mentioned here.

Download Button a trial version , fully functional for 21 days.

Learning still another tool can take a lot of your time?

Not only you're getting offline (in addition to online) help, sample solution, and template project items. For a limited time, I offer free solutions to your Asp.Net testing problems. Just mail me at art@sm-art.biz with your problem, and I'll write a test for you, with comments, and send you within 24 hours. So, if Ivonna is not the tool for you, you won't even waste your time figuring it out.

 

Ivonna is being developed in partnership with TypeMock and runs on top of the TypeMock Isolator framework.

Latest news

Latest blog posts

Powered by FeedBurner