samedi 3 janvier 2015

Guice-servlet unit testing

Background: I'm developing servlets using guice with guice-servlet frameworks. I'd like to test my servlets by:



  1. Servlet unit tests: isolating servlets from other dependencies and simulating client, by providing get/post requests

  2. Servlet integration tests: simulating clients, but without servlet isolation. Also, as part of integration tests, I'd like to test my integration with Guice itself.


Question: I'm looking for servlet testing framework which can allow me to perform both kinds of tests described above.


Meanwhile I took a look at HttpUnit, but I didn't find a way to connect Guice to it: servlets can be registered in ServletRunner, but they are provided by class name. This means that ServletRunner will instantiate them (without injecting dependencies).


Also I found tadedon project's GuiceServletMockModule. Seems like exactly what I'm looking for. But I'm not sure it is still maintained. For example, I was not able to fetch their maven package from their maven repository.


Thanks


Aucun commentaire:

Enregistrer un commentaire