Skip to content

tipps for using FakeIt

David Hebbeker edited this page Feb 13, 2024 · 1 revision

handle exception fakeit::UnexpectedMethodCallException

In case you receive an fakeit::UnexpectedMethodCallException exception while running unit tests with mocking using ArduinoFake/FakeIt. It may not be clear which method call has triggered the exception.

To do so, debugging can be helpful:

  1. Build the test using platformio test --without-testing --environment ...
  2. In VS-Code start the debugger "PIO Debug (skip Pre-Debug)"
  3. Add a function breakpoint for abort
  4. Run the debugger
  5. In case of an exception analyse the call stack to find the method which has not been properly mocked