JavaRanch Home    
 
This page:         last edited 13 February 2008         What's Changed?         Edit

Unit Testing Web Applications   

You probably can't really have UnitTests? for Web applications, per se. What you want are FunctionalTests, or AcceptanceTests? as they're called in ExtremeProgramming. (The semantics of the difference between FunctionalTests and AcceptanceTests? are beyond the scope of this instance of the universe.)

If you want to automate your FunctionalTests or AcceptanceTests?, you have some options available:

Plus, of course, all the options not listed here ... :) (If you know of some, you should simply add them here, of course!)



Discussion

Actually I'd say that you very well can unit test web applications.

First, the only thing that differs between web- and other applications is the GUI. So you can test your business classes, persistence classes etc. just as usual.

Second, parts of the web-tier can be unit tested, too. It's not that hard to unit test servlet classes by using MockObjects?, for example. There are also libraries for unit testing taglibs. My general advice, though, would be to make the web-tier as thin and dumb as possible, so that it doesn't need much unit testing.

-- IljaPreuss


JavaRanchContact us — Copyright © 1998-2014 Paul Wheaton