-
Improvement
-
Resolution: Unresolved
-
Major
-
None
Currently, many parts of the NAnt plugin are difficult to unit test because of dependencies on objects whose behavior cannot be mocked. In addition, integration testing a plugin such as the NAnt plugin is difficult, because the behavior varies between operating systems, and the OS is not something that can be changed during a test. Because of the difficulty of integration testing the NAnt plugin, unit testing becomes even more critical. Unfortunately, many of the key Hudson objects used by the NAnt plugin (i.e. Launcher) cannot be mocked at all. In order to make unit testing a larger portion of the plugin possible, much of the code will need to be refactored to make use of custom wrapper Interfaces and dependency injection (i.e. using an IoC container such as Spring) to allow key elements to be mocked and for mock implementations to be injected in to the plugin during tests.
The effort to make the NAnt plugin more testable may likely require changes in the Hudson Core module as well. For instance, the Launcher.ProcStarter class is currently decalred final, making it impossible to create any kind of mock/fake ProcStarter object for use within unit tests.