Page 1 of 1

Syncor Unit Testing Framework

Posted: Thu Mar 03, 2011 2:14 pm
by tod
You have no excuses now!
I know that doing unit testing on embedded systems has a high barrier to entry. I've spent considerable time trying to lower that barrier for the NetBurner. I've developed a unit testing library based on the open source UnitTest++ project. I then created a web project to provide a graphical unit test runner for the framework. All you need to do now to do unit testing, is import this project into your workspace and write the tests. Once the tests are writting do a build and load and navigate to the unit test web page and run your tests. I took this approach to make the tests as useful as possible. Your tests run on the actual NetBurner hardware and use the same libraries your actual code will use. In addition if you have custom hardware that you can write to and read from you can incorporate that hardware into your unit tests.

It might seem that running the tests on the actual embedded hardware would result in a long delay from writing the tests until seeing the results. However the combination of the NetBurner's ability to load the application over Ethernet and the speed of the GNU compilers makes it quite acceptable. In the video demonstrations, I didn't do any time lapse or editing tricks. The cycle time you see in the second demo where I'm writing actual tests and running them is the time you can actually expect it to take.

If you watch the videos that are referenced by the readme document it will take you about 25 minutes to install and learn how easy it is to do unit testing now. I have found there are several advantages to having a unit testing framework available outside of the normal reasons for doing unit testing.
  1. You can easily learn about and experiment with NetBurner capabilities
  2. You will see a lot fewer TRAP conditions that make you resort to FLA and the serial port to get your NetBurner in a usable condition again. Since the tests have to be invoked from the web page, if any test causes a trap, it won't happen again on reboot.
I've never released a full project that is quite like this before. I tried my best to remove dependencies to my source code control system and anything else that is not part of the standard NetBurner development package. If you have problems please let me know. The attached framework was written and tested for the MOD5272. In the videos I explain what steps I think you need to take to make it work for your hardware. I believe you only need to edit a few include paths and a library path.

If you want to watch the videos first you can see them here:
The first screencast is a demo of how to use this unit testing framework to test either libraries or NetBurner device executable files. (Approx. length 9 minutes)
The second screencast shows you how to write tests of increasing complexity. It covers using fixtures and how you can do compare tests with vectors. (Approx. length 12 minutes)

UPDATE: 3-23-2011
I found a problem where if the generation of an output message contained a line feed character it would look to the JavaScript eval() method like an unterminated string. You would probably only see this if you created a class with your own operator<< and in that method created a string with an embedded linefeed. I re-uploaded the entire project but if you've already downloaded it the only thing you need is the updated UnitTest++.a file. So once you download just copy that library over to your project.

Re: Syncor Unit Testing Framework

Posted: Mon Mar 14, 2011 10:21 am
by tod
Mark Richards got the Syncor Unit Test Framework up and running with a 5270B. He found that my advice about NOT reloading the selected platform's properties file did not work out well for him. He was nice enough to write up step by step instructions with screen shots on what he found to be the fastest, cleanest way to recompile the framework for the 5270B platform. I posted his write up on my blog in this post. I suspect the steps will be valuable for porting to other platforms as well.