CodersBarn.com
The ASP.NET Community Blog

ASP.NET Lightweight Test Automation Framework

February 15, 2009 11:39 by agrace

I have great difficulty in broaching the subject of testing. We all know the benefits of Test Driven Development (TDD). I believe also that a lot of us pay lip service to it in that we usually implement "our own version" of testing. It's kinda like "a la carte" religion these days whereby "I have a spiritual side" becomes a euphemism for being a "lapsed catholic". Most of us are guilty, the rest are liars.

I have a very caveman-like approach to testing: When I'm writing code for even the simplest Web application, I don't trust a single line of code I write. I will never move from one block of code to the next without checking my presumptions about values held in the previous block. When you work in a RAD environment, you have to constantly make intelligent decisions about such issues as you bring the code forward. As for creating a test plan in advance, get real! Software is written by developers working in real-world environments, under real-world pressures. If you are going to come up with a realistic software quality/testing methodology, then you have to develop a methodology which relates to the way people have to work. If you think I'm being insane then just check out the reaction to the recent comment by no less than Joel Spolsky that "Quality just doesn’t matter that much.”

Lightweight Test Automation Framework

This new testing framework for ASP.NET from Microsoft is a welcome step in the right direction. By "welcome", I mean that we need this, and more. There are tools like NUnit out there already but it behooves the creators of the framework to come up with the best testing tool for that framework - although not written by the same people! Did you ever wonder why they didn't create the test plans and tools in advance? If they had tested first before bringing the recent versions of ASP.NET to market, we'd all be back to writing Java by now. This tool was developed by the ASP.NET QA team to implement regression testing. Maybe now we might be able to apply CSS to all the OOTB controls?

The sample download is based on a Website template - so much for offering continuing support for the Web Application project template. I downloaded the samples and attempted to test an existing ASP.NET application targetted at .NET 3.5 by following the instructions provided. I added the reference to the Microsoft.Web.Testing.Light.dll. If you try to copy the two test pages into a folder using VS Solution Explorer, you will get the following error:

"The source files for this operation cannot be found in this solution"

Instead, copy them into a folder in the project you are testing using Windows Explorer, and then use "Add Existing Item" in the VS Solution Explorer window to include them in the project to be tested.

I decorated my class with [WebTestClass] and my method with [WebTestTag("test")] but had difficulty running the test when following the instructions provided. Eventually, I got it to "run" by using the following URL:

http://localhost/myproject/test/Default.aspx?run=true

When I say I got it to "run", I got the following results:

Lightweight Test Automation Framework

I also got a JavaScript "Sys.WebForms.PageRequestManagerServerExceptionError" warning when attempting to include a write to the log.

I didn't have any more time to fire at this and I would be very interested in getting feedback from others using this tool to test Web Application Projects; definitely fodder for another blog post.

Like most projects on the CodePlex site, proper documentation is non-existent. When the project in question comes from Microsoft, I expect better. At the very least, specify the requirements on the home page such as framework version and if it is aimed at Website or Web Application projects, or both. Please don't make me dig for some passing hint to this information in the little documentation that was provided. And if you run into problems don't even think of using the CodePlex search engine, unless you're planning a vacation while waiting for the results to come back.

kick it on DotNetKicks.com


Tags:
Categories: ASP.NET | Testing
Actions: E-mail | Permalink | Comments (7) | Comment RSSRSS comment feed

Comments

February 16. 2009 12:45

trackback

Trackback from DotNetKicks.com

www.codersbarn.com/.../ASPNET-Lightweight-Test-Auto

DotNetKicks.com

February 16. 2009 13:02

trackback

Trackback from Web Development Community

ASP.NET Lightweight Test Automation Framework

Web Development Community

February 16. 2009 13:07

trackback

Trackback from DotNetShoutout

ASP.NET Lightweight Test Automation Framework

DotNetShoutout

September 5. 2010 02:12

seo top 10

Hi, i read your blog occasionally and i own a similar one and i was just wondering if you get a lot of spam comments? If so how do you prevent it, any plugin or anything you can recommend? I'm getting so much lately it's driving me mad so any help is very much appreciated.  Anyway, in my language, there are not much good source like this.

seo top 10

September 5. 2010 02:15

sim so dep re

Hi, i read your blog occasionally and i own a similar one and i was just wondering if you get a lot of spam comments? If so how do you prevent it, any plugin or anything you can recommend? I'm getting so much lately it's driving me mad so any help is very much appreciated.  Anyway, in my language, there are not much good source like this.

sim so dep re

September 5. 2010 21:09

Carpet Cleaning Atlanta

Thank you for posting this. I really appreciate it. Sunrise Clean Care & Water Restoration 3822 Peachtree Rd Northeast, Atlanta, GA 30319 (770)921-0161

Carpet Cleaning Atlanta

September 6. 2010 09:09

Brain Exercises

Eeek!  This is great.

Brain Exercises

Add comment




  Country flag

biuquote
  • Comment
  • Preview
Loading