Embedded Unit Testing

Good afternoon:

I need to perform some unit testing and I'm totally lost. Right now I'm working in two projects. In the first one I use a Freescale MC908AS60A microcontroller with Cosmic compiler and the other one a Infineon XC161 with Tasking C166 compiler.

The manager is asking me to perform Unit testing on host and on target. I have been able to perform some testings on host, but I need to do many modifications to the original code in order to be able to compile it with a host compiler.

I have reviewed some of the automated tools available and none of those have the compiler-target combination I need.

Did any of you have performed a Unit testing similar to this one?? How do you modify the code to be able to use 2 different compilers?? How do you perform on target testing??

Thank you.

Reply to
Enrique Lizarraga
Loading thread data ...

Use conditional compilation to handle the compiler specific changes. Drive the unit testing from stub code.

I would recommend trying out cppunit:

formatting link

CCPUnit lets you automate the tests. You can the unit tests as regression tests in later releases.

-- EventStudio System Designer 2.5 -

formatting link
Sequence Diagram Based Real-time and Embedded System Design Tool

Reply to


Optimal result is acheived, if you make as small changes as possible (no #ifdef or simulary)...

Ofcause you need to recompile for your host and target respectively ... depending on where the tests run.

I have often made a small (!Note here below) module that encapsulate the module/objects or even smaller a function.

!Note: this module (wrapping the fnc's being tested) needs to simulate what-ever environemnt your fnc's requires, and depending on its Linux, Windows or a properitary RTOS, this needs to be ported to the simulation/testing environment.

Then - with these basic functionalities supported - it easy to start testing embedded code on your eg. PC

rg, johnk

Reply to

How much effort you build these wrappers?


Reply to



formatting link

They do the Tessy tool that will do in target testing when used with an ICE. That is hard real time unit testing on the actual target.

Once set up it is fully automated.

In article , Enrique Lizarraga writes

\/\/\/\/\ Chris Hills  Staffs  England     /\/\/\/\/
 Click to see the full signature
Reply to
Chris Hills

"I have been able to perform some testings on host, but I need to do many modifications to the original code in order to be able to compile it with a host compiler."

What mods? This is probably a good thing since you want to isolate target specific stuff from your "problem solution" code. We target 16 or 32 bit processors that can use standard C ( easily compiles for host and target) so maybe I can't relate to your particular environment.

I'm not convinced unit testing on the target is worth the effort. I have tried a fair number of tools and most are a pain to use. Better to convince your boss that this will cost too much time and money. On the other hand, good unit tests ( -> good test cases) on the host is a must so you're not trying to debug junk on the target.

If your target is big endian, you may want to setup Linux and gcc on a cheap Mac PowerPC box (get 'em why you can) so you don't run into that thorny issue.

Reply to

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.