2

is there any way to unit test my classes written in c++ for ESP8266 Arduino platform? I really cannot find anything related material on the internet. I thought a widely used c++ unit testing library will work, but arduino is different as it has no try-catch blocks (thus exceptions) and other disadvantages compared to standard c++ etc etc.

What i need is simple: some assertion library, structuring capabilities (suites,test cases,...) and some kind of mocking and checking whether a method was called or not. Can anybody help?

zak
  • 115
  • 1
  • 9

1 Answers1

2

I've just completed writing a fairly extensive unit testing library called arduino_ci, and I've placed a decent writeup as an answer to a related question.

It doesn't offer the "was this method called" functionality you are asking for, but everything (including pin values and serial IO) is (or can be) mocked.

A few examples:

Ian
  • 11,280
  • 3
  • 36
  • 58
  • Update: this is now available as a GitHub action https://github.com/marketplace/actions/arduino_ci – Ian Apr 21 '21 at 20:49