venkysmarty
venkysmarty

Reputation: 11441

Unit testing for embedded system

I am having a product which runs on Vxworks on end product hardware. But development is done in Visual studio using cross compiler and downloaded to hardware for testing. I am planning to write unit test cases for product. My question is because my development is done on windows and how can I run unit test cases as it is not resemebling real scenario?

Any inputs are welcome

Upvotes: 1

Views: 1803

Answers (3)

Tormod
Tormod

Reputation: 4583

I suspect that you have code that interacts a lot with VxWorks through system calls. Putting a layer of abstraction in there will be hard.

Are you using c or c++?

If you are using c++ and you can identify parts of the system that:

  • are subject to frequent change; and
    • are mostly handling internal data; or
    • just relating to a predefined/formalized subset of the surrounding system (e.g. protocol handling or individual PLC control logic modules).

Then you should first inject c++ interface(s) between the module and the rest of the system. This module should only relate to the interface(s)/adapter(s). Then you have an isolated piece that can be strapped into a visual studio test harness.

Then you should try to identify areas in your system that are error prone to bugs, subject to (frequent) change or audit. You will probably never achieve even 50% coverage on the target system, but you can achieve a system where 90% of the daily coding happens within the covered 40% of the code base.

Upvotes: 1

wallyk
wallyk

Reputation: 57804

You do it just like any other system:

  • Write the unit tests
  • compile and load into target system
  • run unit tests
  • verify results

Where it runs is immaterial. The biggest difficulty is on an embedded system with limited output capability. But even if there is only a single LED, it should still be possible to signal success and failure. Only it is a little more abstract than showing "passed".

Upvotes: 0

Raphael Bossek
Raphael Bossek

Reputation: 1954

Not possible without additional effort (new project; compile twice; for your host and let it run on your host) In this case search for an development environment that support your target for unit tests, for example http://www.parasoft.com/jsp/products/embedded_cpptest.jsp

Go on reading at parasoft C++ unit test question .

Upvotes: 0

Related Questions