There are many options for doing unittesting of web application. Some of these tools are HttpUnit, HtmlUnit, Cactus, Canoo, JWebUnit, JMeter, Selenium and so forth.
My understanding is, all of these web unit testing tools require that the main web application (that is being tested) should be running, in order to be able to test the unit test written using HttpUnit, HtmlUnit etc.
Is my statement above true?
My goal would be to be able to run the unit test (written using HttpUnit, HtmlUnit etc.), even if the main web app were not running - similar to Junit that does not require any app to be running.
Is there any web unit testing tool that would allow to do unit test, even if the main app (that is being tested) were not running?
When we run a JUnit test, JUnit really runs the code (java application in a sense) to test the code.
I do not know, but this is my opinion on HttpUnit. There is no way to test a web application without running the application in an app server. HttpUnit is testing User navigation functionality.
It depends greatly on the framework. For instance, it most modern action frameworks (Spring MVC, Struts 2, Stripes, etc) its very easy to unit test their building block pieces -- speaking in Struts 2 terms -- Actions, Interceptors, Converters are all very easily tested in isolation. With Struts 1 its much, much tougher... wouldn't say impossible, but probably not worth the effort.
If you're using jWebUnit or HttpUnit, you are NOT unit testing, nevermind the tools name. You are end-to-end, integration, acceptance testing.