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 ...

Get Mockito Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.