| |
 |
Monday, April 08, 2002 |
Using Unit Tests. Thoughts on unit testing and refactoring. [The .NET Guy] I hadn't heard of NUnit before. It looks interesting, but I can't use it yet. I use .NET to write tests for COM components, not for .NET assemblies.
I have an HTTPTester project that is going well. A test suite is an XML file. Each test is a URL. HTTPTester provides the facilities to save the result in a file and compare it with the expected file. Because the results are usually long XML or HTML strings, I don't define the expected results before running the test, the way I usually do. Instead, HTTPTester has a Copy to Expected button which I use after a careful manual inspection of the actual output. The Compare button took a few minutes to implement - it just calls Windiff for the two files - and it's all I need to see where the differences are. There's also a side-by-side view that is simply two frames that both implement an IE browser. Small cost; huge benefit.
One thing I always add to a test project that I didn't see in NUnit is a way to automate it. HTTPTester can take a test file on the command line and there are command line switches to shut itself down if there are no errors and send an email if there are errors. It also posts the last run results in a file. So I'll be able to schedule it on my machine at the office and check it from home and be alerted if it failed.
8:14:57 AM
|
|
© Copyright 2002 John Sands.
|
|
|
|
|