Exploring testing impediments
This section explains the nature or quality of code that makes unit testing difficult. Automated tests help us develop software quickly, even when we have a large code base to work on. Automated unit tests should be executed very fast so that the tests can give us quick feedback, however we cannot unit test code when it exhibits any of the following symptoms:
Performs long running operations
Connects to a database and modifies database records
Performs remote computing—RMI
Looks up JNDI resources or web/application server objects
Accesses filesystems
Works with native objects or graphical widgets (UI components, Windows alerts, JAVA Swing components, and so on)
Accesses network resources (LAN printer, downloads data from the Internet, and so on)
Unit tests should not wait for a long running process to complete; it will defeat the purpose of quick feedback.
Unit tests should be reliable and they should fail if, and only if, the production code breaks. However, if your...