Test code vs. production code

Testing is an integral part of software development. There has been a growing awareness on unit testing—and testing in general. Test and production code differ in nature an intent though. For instance, code duplication is bad in production code, but fine in test code; or production code can afford some complexity to be generic, but test code should be simple and specific. Test and production code coexist in most project, yet programming language have little support to distinguish between the two.

To avoid scattering test code all around the code base, dependency injection has been adopted by many practitioners in industry. It is however on a very partial solution; dependency injection frameworks are general purpose, and more specific solutions would be welcome if their usage is solely to ease switching between test and production code.

A few research questions that I would like to tackle are: