2020-06-10 12:51 PM
Hi,
I wanna use TDD on my projects. So; I try implement CppUTest or Unity Test Frameworks but i couldn't do it. Is there anyone use this test framework on STM32CUBEIDE? What could be wrong? When i try build project , i get so many errors. (like : no such file or directory...)
if there is a tutorial for beginning TDD for STM32CubeIde , it would be so helpful.
Best Regards..
2020-06-10 01:16 PM
I use unity.
The console print in the lib is an issue. Disable console prints.
File not found will just be an issue of paths. Check again.
2020-06-11 12:14 PM
Hi,
Thanks for your response. Sorry i couldn't understand "console prints" exactly. Did you mention "UnityPrint" functions? Is there a #define for disable all console print functions?
And when i add simple code i get this errors >> undefined reference to 'UnityBegin' , undefined reference to 'UnityEnd' ... . I added screenshot too.
/* USER CODE BEGIN Includes */
#include "../../Unity/src/unity.h"
#include "../../Unity/src/unity_internals.h"
/* USER CODE END Includes */
int main(void)
{
UNITY_BEGIN();
int a = 1;
TEST_ASSERT( a == 1 ); //this one will pass
TEST_ASSERT( a == 2 ); //this one will fail
return UNITY_END();
}
2020-09-29 06:09 AM
I'm also very interested in integrating tests inside the STM32CubeIDE. I have asked a similar question since the UI actually shows a checkbox to add unit tests.
2024-10-24 12:48 PM
I am using cpputest and am running it from the command line. Just type make after every test/refactor. This works with any IDE, because the tests run on the pc, not on the STM. If you carefully design your software (i.e. keep everything hardware-related separate), this work very efficiently. You don't even need hardware until the software is nearly finished :)
So I just use a console window in STM Cube to make the tests, rather than trying to use anything integrated.
2024-10-30 02:02 AM
It's great to hear that someone has implmented cpputest in the Cube ecosystem successfully. I've been trying to do the similar thing recently.