I'm new to Java EE web app testing. Can some one explain how to test the se开发者_StackOverflowrver-side components in a Java EE app ? Any code snippets or pointers to web articles will be of help.
Mdo's reference covers the basic options quite nicely. There is a lot of mileage in out-of-container unit-testing POJOs, ignoring their "EJB-ness".
However my experience is that the really interesting stuff doesn't start to happen until you are exercising the server-side code more completely. For example when transactions and concurrency issues start to play.
My practice is to write tests against the formal API of Web Service and EJB interfaces. The test themselves can be written in using JUnit. Haveing got a good set of tests, and which may well rely on Mocking some services and/or populating databases with specific data, I can then not only test major functionality but can create stress and load tests.
精彩评论