Skip to Navigation

matthine.com

Web interface testing and automation

Some time ago, I had a client requirement for continuous live testing of an online application process. It was a multi-step application for insurance, so it had a lot of server-side logic, as well as plenty of client-side javascript validation. Obviously, the best way to test this is to simulate a real browser session. This way you can detect obscure errors such as javascript validation errors stopping form submissions - things that would not show up in standard unit testing. For instance, you could upgrade your core javascript libraries to get the latest animation capabilities for your homepage widgets and not realise they are not backward compatible with your postcode validation routine. Visitors would be getting obscure javascript errors and you would not know about it until someone took the time to tell you.

At the time, I used an IE COM automation library, which worked OK but was a bit flaky. I forget the name and I don't think it's about any more. The idea was that a script would run every hour to send a complete application through the system. If it encountered any problems, it would email an administrator. The resulting record was subsequently deleted from the database.

Recently, I had a similar requirement - to continuously test a shop's checkout system. With more moving parts (server-side logic, address search and verification, javascript validation and the payment gateway), there was plenty to go wrong. I initially started using Selenium, which has a great Firefox extension for recording test scripts. However, I started to get bogged down in the next step - integrating with NUnit. Selenium requires a Java-based Remote Control server to be running to work outside Firefox. While I am sure this is fine, the idea of having a Java-based server running to execute .NET tests didn't appeal. And I wanted a testing system that could run as an NUnit test in the NUnit GUI, as well as a scheduled job (probably using NAnt). So I continued looking for a pure .NET solution.

I then found ArtOfTest's WebAii automation framework, and it fit the bill perfectly. It's straight .NET and has a simple API. I just read through one of their NUnit quickstart projects to get an idea, referenced the WebAii assemblies, then started writing my unit tests. They also sell an 'Automation Design Canvas' for recording macros, but I was happy with the free WebAii.

If you need to do frequent or repetitive web UI testing, or need to run regular automated tests against live servers, I'd recommend checking it out.  I'll write up a quick tutorial on getting the whole thing working at some stage.