<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/introducing-the-trompeloeil-c-mocking-framework-efsv46xan" -->

---
title: Introducing the Trompeloeil C++ mocking framework
description: Trompeloeil is a header-only C++14 mocking framework designed for ease of use without sacrificing expressive power. It uses macros like MAKE_MOCK,...
canonical: https://daily.dev/posts/introducing-the-trompeloeil-c-mocking-framework-efsv46xan
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Introducing the Trompeloeil C++ mocking framework | daily.dev
og:description: Trompeloeil is a header-only C++14 mocking framework designed for ease of use without sacrificing expressive power. It uses macros like MAKE_MOCK,...
og:url: https://daily.dev/posts/introducing-the-trompeloeil-c-mocking-framework-efsv46xan
og:image: https://api.daily.dev/og/posts/Efsv46XAN.png
og:image:alt: Introducing the Trompeloeil C++ mocking framework
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Introducing the Trompeloeil C++ mocking framework

**[Playful Programming](https://daily.dev/sources/playfulprogramming)** · 6 min read · 0 upvotes · 0 comments

## Summary

Trompeloeil is a header-only C++14 mocking framework designed for ease of use without sacrificing expressive power. It uses macros like MAKE_MOCK, REQUIRE_CALL, and NAMED_REQUIRE_CALL to define mock classes and set expectations on method calls. Key features include sequence ordering of calls, wildcards, call count constraints (TIMES, AT_LEAST, AT_MOST), side effects, and the distinction between value-capture and reference-capture variants (LR_ prefix). The framework integrates with existing test runners and follows lifetime-based expectation enforcement via C++ scope rules.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://playfulprogramming.com/posts/introducing-trompeloeil-c-mocking>

## Similar posts on daily.dev

- [Typemock releases Isolator\+\+ 5.4 for improved C\+\+ testing](https://daily.dev/posts/typemock-releases-isolator-5-4-for-improved-c-testing-hcjm7z1rg) · SD Times · 0 upvotes · 0 comments
- [test-part2](https://daily.dev/posts/test-part2-vn8busjnf) · C\+\+ · 0 upvotes · 0 comments
- [Let’s Build a Unit Testing Library From Scratch](https://daily.dev/posts/let-s-build-a-unit-testing-library-from-scratch-kbtssyqva) · Medium · 0 upvotes · 0 comments
- [Mocks Are Your Friends, Not Your Servants](https://daily.dev/posts/mocks-are-your-friends-not-your-servants-ii0t7a6yi) · Beam Bloggers Webring · 0 upvotes · 0 comments

---

Tags: [#testing](https://daily.dev/tags/testing), [#c++](https://daily.dev/tags/c++), [#tdd](https://daily.dev/tags/tdd)

[View this post on daily.dev](https://daily.dev/posts/introducing-the-trompeloeil-c-mocking-framework-efsv46xan)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Introducing the Trompeloeil C++ mocking framework","url":"https://daily.dev/posts/introducing-the-trompeloeil-c-mocking-framework-efsv46xan","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/introducing-the-trompeloeil-c-mocking-framework-efsv46xan"},"datePublished":"2026-03-16T21:48:30.791Z","dateModified":"2026-03-16T21:53:31.701Z","description":"Trompeloeil is a header-only C++14 mocking framework designed for ease of use without sacrificing expressive power. It uses macros like MAKE_MOCK,...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/686b7a9974686090766068433f38f0f3?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/686b7a9974686090766068433f38f0f3?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Playful Programming","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Playful Programming","logo":"https://media.daily.dev/image/upload/s--WoGOmY81--/f_auto,q_auto/v1773697582/logos/playfulprogramming?_a=BAMAMiiu0","url":"https://daily.dev/sources/playfulprogramming"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/introducing-the-trompeloeil-c-mocking-framework-efsv46xan","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"testing,c++,tdd","timeRequired":"PT6M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Playful Programming","item":"https://daily.dev/sources/playfulprogramming"},{"@type":"ListItem","position":3,"name":"Introducing the Trompeloeil C++ mocking framework"}]}
```

