Fallacy 9: It is sufficient to ensure the functionality of a distributed application with unit- and integration-tests. 📎
Because the advantage of Java EE is the ability to process concurrent users, it would be also interesting to test the application under load. In this case it is not so important to check the performance, it is more important to ensure the long term stability. The tests do not have to be realistic, the main motivation for such tests is to see the application's behavior under heavy load (night run). CPU, memory consumption, the pool size and request distribution among the cluster nodes should be stable. It is amazing how many, deadlocks, non-working XA-transactions, consistency issues, OutOfMemory, memory leaks, bottlenecks (synchronized methods) etc. you will see. Some of these issues can even need a complete refactoring of your business and UI-logic (e.g. moving from pessimistic to optimistic locks). To minimize the costs, a distributed application should be load-tested at least once a week. My observation: Java EE application are load tested only few weeks before production. Because there is no more time to fix the problems - no one really cares about the results...
Some useful tools:
- JMeter, Grinder, OpenSta(if possible LoadRunner). Load testing frameworks
- JunitPerf: collection of JUnit test decorators used to measure the performance and scalability of functionality contained within existing JUnit tests.
- JConsole: part of Java SE 5. A JMX-monitoring tool. You can monitor easily the CPU, RAM, Threads etc.
- LoadRunner (commercial one), is expensive but also powerful.
So Unit-Tests, Mocks etc. are nice, but you can only see whether your application is really working under heavy load.