Jesus, First let's make sure we are using the same defintion of unit testing - testing without external dependencies like a server.
For each of the aspects you mentioned: servlets - Use JUnit and a mock object framework to create a dummy HttpServletRequest. Common frameworks are jMock and easyMock. jsps - The JSPs should just contain presentation. If they contain logic/code, move it to a Java Class and test that java classes - Just write a JUnit test for the object using mock objects as needed. mq - You can unit test that the calls are being made. You will probably want to integration test this part too. That way you have tests that show it works with a queue. log4j - There's nothing really to unit test here. You can assume log4j works and has been tested. If you really want to, you could test that things are being logged (that the calls to log4j are made.)
Thank you Jeanne. I will keep those in mind and study them.
For now, I might resort to manual testing, or hopefully find a code coverage tool.
My environment now is WSAD(can test in local server or in remote server). Any tips on any code coverage software that I can use in this kind of development setup? e.g. easily integrates with wsad, but not necessarily.
In mainframe, I like code coverage as it identifies paths that I have tested through.
Jesus, All of the free code coverage tools I know of run on top of JUnit. My favorite is Emma.
There are commercial tools like JTest that will tell you the code coverage of code you run through the web. They will also generate unit tests based on the actual behavior. These are of small value for initial testing but have the potential to be helpful for regression testing.
If you are looking at integration testing, consider using an end to end tool like Selenium. This tests completely through the GUI without writing any code. It is more similar to QA regression tests, but I find it valuable.