Loading…
This event has ended. View the official site or create your own event → Check it out
This event has ended. Create your own
View analytic
Wednesday, May 17 • 11:00am - 12:30pm
Mocking C++ (full-length version)

Log in to save this to your schedule and see who's attending!

Feedback form is now closed.
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.

Speakers
avatar for Peter Bindels

Peter Bindels

Expert Software Engineer, TomTom NV
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 actu... Read More →


Wednesday May 17, 2017 11:00am - 12:30pm
Bethe

Attendees (27)