Appendix A: Testing with Spring

Overview

Testing is a crucial part of software development; we believe you should not even think about releasing a piece of software that has not been tested in some way. The easiest testing technique is unit testing. It allows you to test each component of the application separately, in a controlled environment. Once you know that all components work on their own, it may be appropriate to run integration tests; however, these tests are difficult to implement, especially when you are dealing with large applications that use EJBs and JTA transactions. In these cases, integration tests may be impossible to write. Once you have tested your application and have found it to be fully functional, it is time to do some performance testing. This type of testing may bring up threading and JVM heap usage issues that you would not notice otherwise.

Some of the testing methods are far too complex for the scope of this appendix, leaving us with just the following issues to discuss:

Introducing unit testing: In this section, we look at how unit tests work, focusing in particular on JUnit framework. We discuss the importance of mock objects in this section.

Unit tests: It is important to write the tests so that you can repeat them any time and always get the same results. We show you methods that allow you to test local transactions and business logic components.

Integration tests: Even though integration testing is difficult in terms of environment setup, we show you some techniques you can use to test the component integration as thoroughly as possible.

Test coverage: Even though this topic is not directly linked to the actual testing procedures, we mention a few test coverage frameworks that help you identify areas of your code that do not have appropriate unit tests.

Performance testing: Finally, we show you the tools to use for performance testing and discuss the issues you might encounter.



Pro Spring
Pro Spring
ISBN: 1590594614
EAN: 2147483647
Year: 2006
Pages: 189

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net