chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
0 votes

I have a large C++ solution, and inside the solutions, I have multiple dll projects. I'm using CppUnitTestFramework and Typemock to write unit tests.

functionA() calls a global functionB() exported to a DDL. How do we usually mock the function in dll with Typemock or other mock frameworks? I tried to use WHEN_CALLED(functionB()).Return(0), but the test still runs the code inside the dll according to the coverage report.

Should I create a small function (in the same class as functionA()) to wrap functionB() and mock this small function instead?

asked by da123 (600 points)

1 Answer

0 votes
Hi da123,

Thanks for reaching out, I am sorry for what you are experiencing.
I don't quite understand what you trying to achieve.
Can you please share with me a sample code ?
This will help us understand what you are trying to achieve.

I'm sending you a private email so you could share the project with me if possible.

Naor Abudi
Typemock support team
answered by Naor_Typemock (1.6k points)