How to perform unit testing / host testing in Eclipse?

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

How to perform unit testing / host testing in Eclipse?

1,787 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mawg on Tue Dec 06 20:36:48 MST 2011
Sorry, I am a n00b. I haven't used Eclipse in years and am totally new to LPC Espresso.

I would prefer to develop my code piece by piece and unit test it on the host (Widnows PC) before letting it anywhere near the hardware.

I also want to be able to single-click re-run all unit tests after any code change, preferably with an easilly visible overview (raffic light?) of succes fail.

How do you generally go about this? Is there any unit test Eclipse plugin that works well with the Espresso IDE?

I'd prefer something very smiple. My system is coded in C, but I can code the test cases in C++ if I must.

Thanks in advance for any help.
0 Kudos
Reply
5 Replies

1,252 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mawg on Wed Dec 28 01:23:53 MST 2011
In the end I went back to NetBeans. I have 2 project files, one Eclipse and one NetBeans which sahre one code tree, so that I can run a quick regression test in Netbeans before flipping back to Eclipse to test on the hardware.
0 Kudos
Reply

1,252 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kalpak on Thu Dec 08 06:53:17 MST 2011
For unit testing, if the functions are less than 32k each, you can use Keil 32k free version.
It has excellent peripheral simulation and scripting interface for simulating external world.
0 Kudos
Reply

1,252 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Rob65 on Thu Dec 08 00:06:41 MST 2011
In the end it all depends on what kind of 'units' you like to test and what you want your test environment to look like.

Is it OK to recompile your code using a (windows) compiler?

You could create a complete simulator that simulates the peripherals you need. LPC_SSP0->CR0 could of course just be a member of a data structure in your simulator. This gives you at least the possibility to check on a PC if you set all the bits in the different registers correct - but in the end it all depends on what kind of tests you want to perform.

But nothing is readily available for this, you'd have to write your own environment for this. Just testing register content should be something which is manageable using Cute.

In 'the good old days' I have used a 8051 simulator that contained a user interface on which you could control all peripherals. There was not that much to control :rolleyes:. Would be much more difficult for the newer MCUs.

Rob
0 Kudos
Reply

1,252 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mawg on Wed Dec 07 20:04:15 MST 2011
I like to be methodical, so that means that the s/w will first be developed on a Winodws PC with s/w simulating the peripherals. I hope that this will maek debugging easier -time will tell..

I intend one single #define to determine if the s/w is being built for host or target and believe that will make regeresion tesing easier (ymmv)..

Yes, Cute does look good; thanks for that. I'll give it a whirl with the option to fall back to CppUnit or even just simple ASSERT()s if I have any trouble.

Thanks very much for taking the time to reply.
0 Kudos
Reply

1,252 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Wed Dec 07 08:03:15 MST 2011
There is no simulator provided in LPCXpresso, so you are going to need to run it on a target board. Unless you write trivial software, you are going to want to be able to use the peripherals on the target (timers, uarts, ethernet, whatever) and these aren't going to exist on your host.

I suggest you search the web for Eclipse (CDT) Unit testing. A quick search showed CUTE and there are probably others. I have no experience of any of them. Sorry
http://www.ifs.hsr.ch/Cute.5820.0.html?&L=4
0 Kudos
Reply