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.”
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:
When I say I got it to "run", I got the following results:
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.