The most important thing is to try to extract all of the servlets that are not directly related to the behavior of the servlets.
This immediately simplifies testing core functionality. By doing so, you will immediately receive a set of components that are not attached to the container and that are tested without pain when working and interacting with the container (in addition to making them more reusable). You need to think about the architecture and the corresponding bundle of components - for example, components that return object structures, not displayed fragments, without using HttpRequests directly, but some query sorting structures, etc.
Most of your tests (depending on your structure and system complexity) can be tested normally. Additional servlet-oriented tests can be built using (say) Apact Cactus to test health. In addition, you can explore solutions in the browser, such as Selenium .
(Note: This approach works for most GUI environments — for example, Swing)
Brian agnew
source share