Unit Testing Beyond Mock Objects

By Sven Rosvall

Unit testing is a well-established practice today. Mocking frameworks are plentiful and available for almost every programming language. We have learned to design our system to make the most of unit testing. We have invented techniques to test our code even when it interacts with the runtime environment and third party libraries that are not designed for mocking out. But there are still obstacles.

This talk will look at a new generation of mocking frameworks that let us mock out static methods, create objects of classes without public constructors, etc. With these tools we can create unit tests for classes that for example use system time without introducing a mockable time provider class and allow our mock methods return mock objects of concrete classes. The focus will be on Java and C#.