Web Acceptance Tests

So you've got an application that uses the web. How do you write AcceptanceTests for it?

Maybe-viable methods include:

Testing the HTML output.

Pros:

Cons: Testing an intermediate representation, such as XML.

Pros:

Cons: Using Tcl windowing scripts (such as WinTclSend)

Pros:

Cons: Using WindowsScriptingHost control over the InternetExplorer object.

Pros:

Cons:


Note: If you have actually used one of these methods, please add your experiences above.


What about using something like JMeter? http://jakarta.apache.org/jmeter/ It's primarily designed as a load testing tool, but is it a good or bad idea to use it for AcceptanceTests?


How I've been doing this lately:

Trying to test web applications in toto has proven too difficult to be worthwhile, so shrink it as far as possible until it's so thin that while you may not be happy leaving it "untested" you can at least be reasonably confident about it.

It may not sound XP, but XP is pragmatic, right? In my experience, the cost of doing unit tests on the part of the web application that can't be shoved into an independent library far exceeds the benefits; generally the biggest problems left over at that point are browser layout differences anyhow and your Unit Tests can't really catch those in a meaningful fashion.

This implies the use of an environment where you can create code that runs in both a web server and a separate test suite. This eliminates some environments from consideration, such as old-style ASP code based on Visual Basic Script. I think you mostly have to just face the fact that there is no reasonable way to test ASP code, because the environment is inimical to this style of working.

We're over 10 years into the web revolution now; if someone was going to figure out how to write useful and flexible testing code for web applications, I think somebody would have done it by now. Instead, what we have either doesn't work, or is so difficult, tedious, and fragile to use that nobody wants to use it (which is just another form of not working). It's time to throw in the towel.


CategoryTesting


EditText of this page (last edited November 6, 2004) or FindPage with title or text search