Search code examples
javaunit-testingservletstestngmockrunner

Servlet unit test


Currently I'm using TestNG framework for testing application business logic, i added some Servlet classes recently.

How do I unit test these Servlet classes in TestNg framework?


Solution

  • Follow skaffman's advice if possible. If not, or if you want to test the behaviour of the servlets as front-end controllers, rather than the business logic inside them, you can use: