cancel
Showing results for 
Search instead for 
Did you mean: 

Use Ceedling for a unit test framework with STM32CubeIDE

aw_von
Associate II

I am looking to use Ceedling for a unit test framework and want to use STM32CubeIDE's Unit Test support for running it in the IDE. I have successfully set up Ceedling and am able to run from command line, but it would be nice to at least understand how to run in the IDE.

 

I have read over a couple different tutorials for setting up unit testing in the IDE, but haven't found guidance on addressing the issue(s) I have; perhaps I am not approaching the problem correctly.  I use Ceedling to set up the initial unit test folders and project.yml file in my project folder structure.  From searching around the internet, it would seem that I need to set up a Run Configuration specifically for running tests.  I got the Eclipse C/C++ Unit Testing Support plugin, created a Unit Test Run Configuration for my project and added details for Ceedling. I am using Google Test runner for the output, and have the project.yml file set up to output gtest like reports.  I have set up the arguments for clobber and test:all.  

 

When I attempt to run, Ceedling always fails to launch.  I attempted to put the C/C++ Application as the bin location in Ruby (where my Windows environmental variable is set to), but get a failure (likely no project.yml file in that location?). When I attempt to set the location of Ceedling in the C/C++ Application as the folder location for running it in the project (as if I were running it from the cmd line), it doesn't recognize the path, likely because there is no ceedling file there (cmd line is using env. variable, but the IDE likely doesn't use Windows env vars for its command line executions).  I thought about using Eclipse environment variables, but I think those are just text replacements and doesn't address the issue of ceedling executable and project.yml file not being in the same location. 

 

aw_von_0-1718650886705.png

Any pointers on where to start or is there a tutorial or resource I haven't found yet that can help me understand the issue?  Thanks!

1 REPLY 1
Alefal
Associate II

Well, it's an old post but I'm going to share how I got it working in cas anyone would be still interested by this topic.

I was in the same situation aw_son was, first I find how to run ceedling tests from command line and have it set up so it can access directly my project source files. (I really liked this pdf tutorial to learn how to do all this).
In the project.yml file : 

:paths:
:test:
- +:test/**
- -:test/support
:source:
- Core/**
:support:
- test/support
:libraries: []

Then I carefuly follow all the instruction from the ThrowTheSwitch website (https://www.throwtheswitch.org/eclipse) with some tiny twists :

Installing Required Plugins

The Install New Software.. is located in the Help tab in STM32CubeIDE. 
I installed all CDT Main and Optional Features

 

Setting Up Your Project


I skipped all that part since my project was already setup (I import project generated from .ioc file).


Triggering Test from the IDE

I followed everything as described. For the location of ceedling in the C/C++ Application field, I checked where ceedling was installed and I used the .bat extension one. On my windows machine it is located here "C:\Ruby30-x64\bin\ceedling.bat".