Is there any support for unit testing or acceptance testing applications? Has anyone used J2me unit or javolution on the device? What are the best strategies for TDD either on or off the device?
Thanks in advance.
We use a junit bundle to do some testing but we don’t have anything exposed to users. Any Java testing framework that’s compatible with Java 1.4 should work on the BUG. IRT TDD, I’ll defer to others on recommendations.
JUnit comes baked into Eclipse. It facilitates unit testing of regular java stuff and also Eclipse plug-in stuff. I have not tested a BUG application using JUnit on the real or virtual BUG, but my guess is that you would need to use JUnit 3.x since the BUG runs PhoneME, which is essentially java 1.4.
When I test Eclipse plug-ins, I create a testing plug-in that corresponds to the plug-in I wish to test. So if I have an Eclipse plug-in called MyPlugin, I create a testing plug-in called MyPlugin.tests that depends on the plug-in I’m testing. A quick Google search on testing Eclipse plug-ins will give you some detailed instructions. I’d familiarize myself with that process before testing BUG apps.
Since BUG applications are so much like Eclipse plug-ins, I would follow the same general set-up. When you create your testing app, though, include the JUnit jar right in the bundle since the BUG runs independently of Eclipse.
The virtual BUG will run any BUG apps in your workspace automatically if it’s dependencies are met when it’s launched. Make your testing application dependent on the BUG app you’re testing using the service tracker technique, and then kick off your tests in the ServiceTracker’s doStart method. That’s just one way. You could also kick off your tests with a button event or anything else you wish. The output will most likely appear in the workbench console. If you’re on a real BUG, the output will most likely appear in /var/log/concierge.log.
When I get a free moment to play around on my BUG, I’ll see what I can do with JUnit and post the results.
As far as advice on strategies, I would focus on the Virtual BUG until you were satisfied with your tests and your app. The Virtual BUG starts quickly and is easier to work with than the real BUG. The current Virtual BUG will also let you step through your BUG app code to debug. You’ll be able to do this soon on the real BUG, when version 1.4 comes out, but you can’t do it right now.