Code Testing

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Code Testing

1,703 Views
sebasira
Senior Contributor I

Hello everybody!

 

I'm reading a lot about code testing and TDD (Test Driven Development). I found it very powerfull... I've never done automatic test on my applications, I always ran them manually or even worst try to recreate them in the real world...

 

I don't know where/how to start with it... Does any of you do that? 

 

It confuse me sometimes, because I'm developing embedded applications, and I don't know how to test some hardware-related issues such as communication (let' say SCI)... I mean, the code that's ment to manage the communication (driver), not the communication itself...

Or maybe some flash/eeprom routines...

 

Any advice, tip, suggestion, guide would be very helpful!!

 

I've heard of  embUnit and it seems simple and effective... 

 

 

Thanks to all!!!

Labels (1)
0 Kudos
3 Replies

888 Views
grilialex
Contributor II

I also started using TDD in embedded systems this year. I mostly run my tests on PC. I have bought a book i highly recommend if you are new to TDD: "Test Driven Development for Embedded C" by James Grenning.

It uses two frameworks CppUTest a C++ framework to use mainly in your PC and Unity a lightweight C framework for embedded testing. The process is usually to make your tests in your PC with CppUTest and then convert them to Unity for target verification.

I am doing currently on PC unit tests, and the code seems to work without any problems in my target. I would like to compile CppUTests to my CPU (coldfire) but i haven't have the time to complete this step.

In this book you will also find how to make low-level hardware driver testing and generally introduce to the newcomer the important concepts behind this.

For command line execution of tests if you use eclipse (freescale), you may see this link:

Test Driven Development (TDD) in Coldfire - Command line download


Regards,

Ilias

0 Kudos

888 Views
sebasira
Senior Contributor I

Thank you very much Ilias!

TDD seems huge to me and I didn't knew where to start from. I've seen a lot of people recommending the same book as you do. I'm going to read it. I also download the TESTAPE manual, just to see if I can start with that framework (random choice).

There are somethings regarding TDD and embedded systems that I don't understand. For example, the piece of code belonging to the TDD is part of the final application or it's removed when the application is completed?

Best Regards!

0 Kudos

888 Views
grilialex
Contributor II

Dear Sebastian,

TDD code is not part of the final application executable and thus does not count in the total size.

However part of the TDD flow is to compile and execute the tests to the target (the previous step is to compile/execute on host). This means that you may have to compile part of the code and tests (if you are memory limited) in order to download the tests to your target and verify operations.

Because of the difficulties of doing so, i do not execute this step, but i am planning to do this in the future, as it provides a test verification on the desired platform (increasing your confidence). Of course in this case you will need a pass/fail notification (or use your target's printf).

Regards,

Ilias

0 Kudos