What are the best ways to test servlet oriented web applications. With possibly jdbc backed backends.
Front-end = Struts2 and some servlets Back-end = hibernate, some basic jdbc
What are the best ways to test servlet oriented web applications. With possibly jdbc backed backends.
Front-end = Struts2 and some servlets Back-end = hibernate, some basic jdbc
use mocks, easymock is one of the best mock frameworks(or you could use jmock if you like the name better). spring-mock has nice support for mocking servlet classes.
you could also do integration testing with dbunit(to tests your sqls and hqls), but its slow and take much longer to write and maintain. i think you should not do it unless you had some problems with people writing bad queries or database schema is changed a lot.
Most important thing : design for testability.
It means trying to have small independent components (which is almost always a good thing, not only for testability) and test components separately. Inversion of Control (with or without an IoC framework like Spring) can help you a lot in that area. Once you have small components, it's pretty easy to test them with jUnit, easymock or any other standard test utilities.
Testing the frontend, is the most tedious and boring task. Selenium can help you a bit, but there is no silver bullets that I know of.