- How to use unit test framework for embedded systems?
- Posted by jasper77 on April 7th, 2008
I'm a little acquainted with how you would use a unit test framework
when the code you're testing runs natively on your host. So how do you
use a unit test framework when the code is intended to run on a target
system?
For example, the Cxxtest framework is a perl script that parses your
code base, looking for any function that begins with "test" to add to
the test suite, and it creates an executable that will run those
tests. I haven't used it myself, though I'm told you typically tie it
in to your build system so whenever you build you get your normal
executable plus your tests are build and executed. If the tests fail,
the build fails, and it reports stats and points you to where the
failures happened.
So when you use a unit test framework for embedded software, what
changes? Do you build with your cross-compiler, get an executable with
the tests, download them to your target, and run them? Or do you build
them natively on your host and run them there? Or some of each?
Thanks,
- J
- Posted by FreeRTOS.org on April 7th, 2008
Some of each . We typically run tests first in our host environment (where
possible) to iron out most of the procedural type problems in an easy
debugging environment. We then repeat the tests actually on the target
hardware. The test is not marked as PASSED until it has been successfully
executed with the correct compiler, on the correct hardware, with the
correct timing, etc., so the first step is purely for our convenience.
By their nature embedded systems have a lot of interactions with the
hardware, and therefore many tests can only be executed on the target
anyway.
--
Regards,
Richard.
+ http://www.FreeRTOS.org & http://www.FreeRTOS.org/shop
17 official architecture ports, more than 5000 downloads per month.
+ http://www.SafeRTOS.com
Certified by TÜV as meeting the requirements for safety related systems.
- Posted by jasper77 on April 8th, 2008
On Apr 7, 1:39 pm, "FreeRTOS.org" <noem...@given.com> wrote:
Thanks, Richard.
Can you tell me/us which unit testing framework you use, what you
think of it, and why it was chosen?
Thanks,
- J
- Posted by cs_posting@hotmail.com on April 8th, 2008
On Apr 7, 1:15 pm, jasper77 <jeanne.petrang...@gmail.com> wrote:
Another possibility is automatically running them on a simulator, if
it's available
and considered accurate enough.
- Posted by FreeRTOS.org on April 9th, 2008
Expand on 'framework'. What are you wanting it to do?
We use a single small C function that runs through a table of function
pointers (points to the individual tests) and collects the results. I would
not call it a framework.
Regards,
Richard.
+ http://www.FreeRTOS.org & http://www.FreeRTOS.org/shop
17 official architecture ports, more than 5000 downloads per month.
+ http://www.SafeRTOS.com
Certified by TÜV as meeting the requirements for safety related systems.
- Posted by jasper77 on April 9th, 2008
On Apr 9, 2:25 am, "FreeRTOS.org" <noem...@given.com> wrote:
As for what I'm wanting it to do, this article is a good one to go on:
http://www.gamesfromwithin.com/artic...03/000107.html
I'm considering using UnitTest++
http://www.gamesfromwithin.com/artic...03/000108.html
http://unittest-cpp.sourceforge.net/
- J