Problem with (native) unit testing on a large(r) project

That’s EXACTLY my problem right now. I can see, it is still not resolved :confused:

Nah, it is the same lib. I just want to test my classes [files] in isolation. I include one file to test it – why does it build all other stuff that I DON’T include?

If I split my code into more libs, it would be artificial, those files belong together. Just not all of them I want/will test.

Yeah, been there. It is OK to get basic global Arduino stuff, but it does not handle all the libs provided by Arduino. For example Servo.h is missing.

So, now, to test a class that does NOT include any Arduino stuff, I must create a big chunk of mocks to satisfy the builder?

I have one “lib”. Actually, I don’t want any libs, that’s just source code of my application, not some “library”. NVM, names don’t matter that much (or do they?). I have my code, I want to test part of it. I don’t want to make artificial structure that will destroy my app design just to test one [or a few] file[s].


Right now I will split my code into 3 “sections” (or “libs” as you call it):

  • pure cpp [that I want to unit test]
  • ArduinoFake–compatibile [that I also can unit test in native]
  • the rest [not testable natively]

I will also make a GH issue to kindly request that files are builded as requested – files that are not being included, should not magically be built [and thus make testing impossible or make TDD slower].

Sorry, I’m a bit bitter now, I just lost 3 days on this issue, read all the docs, and read ALL the testing threads on this forum, just to figure it out…

1 Like