Questions tagged [fakeit]

A C++ testing framework to create fake mock objects.

7 questions
5
votes
0 answers

Virtual inheritance and class function pointer size

I have the following code, I am using MSVC: template void CanMock() { class SimpleType {}; static_assert(sizeof(void(SimpleType::*)()) == sizeof(void(T::*)()), "Can't mock a type with multiple inheritance or with " …
Dundo
  • 714
  • 8
  • 12
2
votes
2 answers

Mocking External Dependency object created inside a function without dependency injection in c++

I am trying to write unit tests in C++ and am facing an issue with creating mock objects for an external dependency using Fakeit. So we have a class similar to the following: class A { int test_method() { B obj; return…
Sam
  • 21
  • 2
2
votes
2 answers

How can I test a call is made after a delay in google test using a mocking framework

I'm currently trying to evaluate different testing frameworks. When using mocking frameworks (I'm leaning towards FakeIt, but google mock is good too), I know that you can roll your own "performance" testing by using the OS's timer calls before and…
Jeff Lamb
  • 5,755
  • 4
  • 37
  • 54
1
vote
2 answers

Mocking an 3rd party library using fakeit

I am writing my own library/class that makes use of a 3rd party library. I want to write tests for my own class, and mock the 3rd party library. In one of the tests, I want to make sure that when a function on my class is being called, another…
Dolf Andringa
  • 2,010
  • 1
  • 22
  • 36
0
votes
1 answer

Namespace vs Struct / Class / Etc, in regards to mocking and microcontrollers

I'm building a high performance C++ project on the ESP32 microcontroller. I have a number of different parts of my codebase that interact with each other and I'm writing tests for them. I've started using the Catch2 testing framework lately, and…
chrispitzer
  • 991
  • 1
  • 8
  • 26
0
votes
0 answers

How to mock non-virtual methods in c++ with gtest?

Is there a clean and easy way to mock non-virtual methods in c++ with gtest ? Despite using the GoogleMock way that force you to re-declare your mocked class. This feature is essential in my point of view to enable the full potential of BDD, TDD and…
Alaenix
  • 83
  • 6
0
votes
0 answers

Generate data with Fakeit

I'm using fakeit to generate data, but when I type the command "fakeit console user.yaml" I got this error below. I don't know what the problem is. I searched about it on net but I didn't find the solution for this issue. ✖ Models (0/1) …
Farah
  • 45
  • 2