You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@click.apache.org by Andrei Ionescu <ai...@yahoo.com> on 2010/03/26 14:16:39 UTC
How to unit test with click-mock?
I red the available documentation but it's still not clear to me how to
unit test using click-mock properly :(.
For the beginning, my application is using a ServletContextListener to
do some stuff (like init embedded database, prepare some files, etc.) ,
but I don't seem to get it how to unit test if that listener is doing
it's job correctly :(.
How do I simulate with click-mock that what a servlet container would
do? to see if the ServletContextListener works as it should?
many thanks,
Andrei.
Re: How to unit test with click-mock?
Posted by Bob Schellink <sa...@gmail.com>.
On 27/03/2010 12:16 AM, Andrei Ionescu wrote:
>
> For the beginning, my application is using a ServletContextListener to
> do some stuff (like init embedded database, prepare some files, etc.) ,
> but I don't seem to get it how to unit test if that listener is doing
> it's job correctly :(.
> How do I simulate with click-mock that what a servlet container would
> do? to see if the ServletContextListener works as it should?
>
The mock support does not provide a full runtime environment of the servlet implementation e.g.
filters and listeners aren't implemented. Neither is the web.xml parsed or interpreted.
It shouldn't be too hard to add mock listeners. However its worth thinking of when to mock and when
to switch to something more realistic like automated Selenium or WebDriver tests against the running
application.
kind regards
bob