040coders.nl: Talks and Videos. Food and Drinks. Every 3rd Thursday somewhere in the 040 region. 040coders.nl: Talks and Videos. Food and Drinks. Every 3rd Thursday somewhere in the 040 region.



HippoMocks:

Making a Mockery of C++.


Talk

Peter Bindels By: Peter Bindels
From: TomTom N.V.

Talk at Meetup 20170615


Abstract

When unit testing, many times you'll be re-testing already tested components, unnecessarily slowing down your code or pulling in dependencies and unreliabilities you'd like to avoid. There's a way to avoid that - use a mock component that pretends to do what you ask it to, but that instead just gives you the answers your test needs. It's a much easier way to get your tests for corner cases and bad return values written, and it makes them more reliable to boot.

The downside is that to implement it properly, you would need to have reflection. Java and C#, both with great mocking libraries use reflection to create their mock objects, and many times it's been posed that C++ just cannot do it without many macros, manual labor, unreliable scripts or duplicated code, because it lacks the ability. We show otherwise - unlike some C++ mocking libraries would have you believe, you can actually make mock objects without repeating - or implementing for the first time! - the classes you're testing with.


Biography

Original/first author of HippoMocks (github.com/dascandy/hippomocks), first author of cpp-dependencies (github.com/tomtom-international/cpp-dependencies), long-standing moderator at forum.osdev.org. Convinced of the ability of people to make things more complicated than they actually are and working on making it all-around possible to show things aren't actually as complicated as they seem.



contact: organizers at 040coders.nl
contact: organizers at 040coders.nl