Automation using HTTPWatch, IE, C# and NUnit

In the past I’ve written about my use and the value of the testing and development tool HTTPWatch. In the latest release of HTTPWatch (4.1) Simtec has added to its value by exposing an interface to be used for automation. My thoughts on the matter: “Whoa..that’s freakin’ cool, now I can automate some of the things I have to test manually for?”

The HTTPWatch automation interface as described by the folks at Simtec:

“HttpWatch has a comprehensive automation interface that can be used by most programming languages (e.g. C#, Javascript & Ruby). The interface can be used to control the HttpWatch plug-in for IE and access data in HttpWatch log files. If you are already running automated tests, you can integrate HttpWatch and record HTTP level information during your tests. The recorded data that then be checked for certain types of configuration and performance problems (e.g. HTTP compression is not enabled).”

I’ve played around with the new interface for a little more than a week now and the more I play the more I realize how valuable analyzing the HTTP traffic on the fly during an automated test could be. While exploring the interface, I put together a Visual Studio .NET 2003 project with some examples of the things that can be done:

  • Check every request for 404. This isn’t just page requests, this is all HTTP traffic that goes along with the page (e.g. catch broken images, missing .js files, etc.)
  • Check every request for 500. Same as above except for 500s.
  • For performance improvements, check to see if .jpg, .gif, .css, .js are found in cache instead of being downloaded with each page request.
  • For performance improvements, check to see if .jpg or .gif files are greater than a designated byte size.
  • Check that objects don’t exceed a specified download time.

My demonstration project that uses the HTTPWatch interface, IE, C#, and NUnit can be downloaded here (thanks Matt for helping me refactor it). Compile it, point NUnit at HTTPWatch_NUnit_Demo.exe and run the 5 tests. The NUnit Test Suite will conduct the 5 tests noted above against which will work with HTTPWatch Basic Edition (their demo) and the Professional Edition.

The project is pretty simplistic due to it only validating one page, but hey it’s a demo. Now that I better understand the interface, the BIG VISION for its use would to be to be open a browser, turn on HTTPWatch, log all the traffic for each page in my Website, and then conduct a battery of tests against the log, dumping the details to NUnit.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.