Overview
Explore mocking techniques in C++ for efficient unit testing in this conference talk from C++Now 2017. Learn how to create mock components that simulate desired behaviors without relying on actual dependencies, improving test reliability and speed. Discover methods to implement mocking in C++ without extensive use of macros, manual labor, or code duplication, challenging the notion that C++ lacks the necessary capabilities. Gain insights into advanced topics such as virtual functions, marking frameworks, and handling complex scenarios like throwing destructors and virtual inheritance. Understand the advantages and limitations of mocking in C++, and how to effectively apply these techniques to enhance your unit testing practices.
Syllabus
Intro
Marking
Mark Objects
Manual Approach
Virtual Functions
Advantages
Alternatives
Unit Tests
Marking Framework
Limitations
My malloc is not your malloc
Test code
Throwing destructor
Virtual inheritance
Callback reporting
Reify function
Update lambda
Explicit lambda
Feedback framework
Taught by
CppNow