Embedded Unit Testing

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
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.

Re: Embedded Unit Testing
Use conditional compilation to handle the compiler specific changes.
Drive the unit testing from stub code.

I would recommend trying out cppunit:

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

EventStudio System Designer 2.5 - http://www.EventHelix.com/EventStudio
Sequence Diagram Based Real-time and Embedded System Design Tool

Re: Embedded Unit Testing

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.

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

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


Re: Embedded Unit Testing
Quoted text here. Click to load it
How much effort you build these wrappers?


Re: Embedded Unit Testing




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.

Quoted text here. Click to load it

\/\/\/\/\ Chris Hills  Staffs  England     /\/\/\/\/
We've slightly trimmed the long signature. Click to see the full one.
Re: Embedded Unit Testing
"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.

Site Timeline