Unit testing isn’t a new concept in the software engineering field, it has been around for at least the past three decades. At the same time, it is still not so widespread in the embedded industry, even though the situation is getting better in recent years. Read more
thanks for your easy to follow introduction.
I was impressed to see how PlatformIO supports unit testing out of the box.
For the sake of completeness you should mention that, when using setUp() and tearDown(), the circular buffer has to be defined globally and no longer in each test function.
I started working with the native core some weeks ago.
I had a great struggle with selecting a working C++ compiler.
The article recommended MinGW but the hyperlink does not lead anywhere.
Would it be possible to have more details what compiler is recommended? MinGW, MinGW32 mingw-w64, what version?
cygwin64 for example does not compile for me
Im currently using x86_64-12.1.0-release-posix-sjlj-rt_v10-rev3 directly downloaded from github.
I’m not super familiar with Desktop C++ compiler and i think it would be helpful to have “okay download this from this site to get it working 99% of the time”. There are so many GCC C++ compiler for windows and its really hard to understand what is going on or is outdated
EDIT: I’ll open a separate thread for this
Could you try https://www.msys2.org/ ? If it works for you, we will update the docs.
I’ll try that and get back to you.
i have opened a thread about it here
Very good doc. Thanks.
It says that setUp and tearDown are methods, but they look as function. Is there some magic that wrap them in classes?
The example does not work with Arduino which require setup(), loop(), instead of main(). I suggest to mention it there and maybe even include an arduino example.
I think it is just a mistake in the article → there are no test classes with test methods → just functions → Unity is a testing framework for
C – it may work for
C++, but it is not object oriented.
Thanks @dvdnwk. Having all the test methods in a single class would simplify declaring the test code as a friend of the tested class. I think that this is the case with GoogleTest but the platformio docs discourage its usage.
I followed your tutorial but ran into following problem, when trying to extract code in the setup and teardown function it became apparent, that they are not called. I can call setup by implementing it in the main but thats not how it is supposed to work right?
What did I do wrong?
Could I ask you to file an issue here Issues · platformio/platformio-core · GitHub ?
ok will do
ty for the fast reply