> Hi Tomcat developers,
> 
> I'd like to have your opinion on servlet unit testing. I have written a
> simple extension to JUnit called J2EEUnit to do that but I'd like to knwo if
> there is a general consensus on servlet unit testing, regarding it's
> usefulness :
> 
> Do you think :
> 
> 1) It is useless. Just need to put a good facade in front of your business
> code and for the remaining part related to Servlets, functional tests are
> fine (using a tool such as HttpUnit),

+0.5 I think functional tests ( using HttpUnit or GTest ) are extremely
important for servlets ( while unit tests are important for beans and
components used inside servlets ). That doesn't mean unit tests for
servlets are useless - but that servlets/JSPs shouldn't have a lot of
functionality, but delegate to beans/ejbs/taglibs that can be unit tested.

Also, I think that for tomcat testing ( i.e. the container ) functional
tests are more apropriate and efficient, and easier to write ( but doesn't
mean we shouldn't have unit tests  for individual components ).

> 2) It is nice to be able to unit test the part of the code related to
> servlets (i.e. the controller in a MVC model).It is possible to come up with
> a tool to do that (ex: J2EEUnit)

I'm not sure I understand this - but any test is nice as long as it's easy
enough to write.


> 3) With the current servlet API it is not possible to come up with a
> framework that will let you properly do unit tests. It will have lots of
> shortcomings. The only solution is to extend the Servlet API by our own
> Servlet Test API. Then have Tomcat implement it. Once we have this, it will
> then be possible to create a tool/framework that make use of this Test API
> to unit test servlet. The next step will to promote this API so that it
> becomes a standard and other Servlet engine implement it.

-1. Extending the servlet API or implementing any extension in tomcat is
not an option, and a test framework that requires changes in the design or
implementation of the tested application is _bad_. 

It doesn't matter how good the test framework is, if you have to change
your code to use it it's not good enough.

( IMHO )

Costin




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to