Unit Testing docs missing info on how to structure and run tests for app development. Help plz?

Hi everyone, I’ve gone through documentation, forums and code trying to find out how to do a simple unit testing procedure, it doesn’t really seem to be documented anywhere.

Legato docs describe some macros and even a CLI switch that could be used, but it doesn’t give us any example on running a test case so a switch could be used, it really seems painfully incomplete for the moment. Looking through Legato’s code I can see some apps using the API but I haven’t been lucky enough to find out how to execute a simple test yet. Can someone please help out on how to structure files and execute tests please? Thanks for the attention!

The project I’m working on has decided against the Legato unit tests and instead is using the Unity framework. You include the unity header files in a new component, along with test runner source code. That can then use the APIs of other components to test them. Once built and installed on the target you can run the test runner something like app runProc AppName --exe=TestAppExe.

1 Like

Hey, thanks for the tip gnottage, I’ll be looking into it. Ideally we’d like to be able to test the ‘soft’ part of our applications in CI, plz give me a heads up if you know a way to run this on host or docker vm.

That’s the kind of think that I think would be really useful to know! I haven’t figured it out yet. My own recent topic asks the same thing.

hi @salgadobreno , @gnottage,
please check the answer on the topic Code Coverage on target hardware, that gnottage is refered to,
BR