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

Your Privacy

By clicking "Accept Non-Essential Cookies" you agree ACCU can store non-essential cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

Current Setting: Non-Essential Cookies REJECTED

By clicking "Include Third Party Content" you agree ACCU can forward your IP address to third-party sites (such as YouTube) to enhance the information presented on this site, and that third-party sites may store cookies on your device.

Current Setting: Third Party Content EXCLUDED

Settings can be changed at any time from the Cookie Policy page.