12-11-2008 10:54 AM
12-11-2008 11:10 AM
12-11-2008 11:33 AM
12-11-2008 10:27 PM
Trying to use normal JUnit for BlackBerry development is a waste of time, unfortunately. The BlackBerry API is not the same as the J2SE API, nor can it be used outside of the simulator. The only way to really do unit testing is on the simulator. To do that, you need to use a J2ME-friendly (and BB-friendly) unit testing framework.
The most serious ones I've seen so far are J2MEUnit and CLDCUnit, and while the latter looks like a better solution, I've thus far only had experience with the former. I recommend Googling for them, and seeing what you can find.
For one set of examples, feel free to look at some code I put into my own project for testing...
The full source to J2MEUnit, plus a BB-specific quick 'n dirty (but nice looking) test runner UI that I wrote:
Some of the actual test code for my project, as a usage example:
I have been thinking of taking this (and/or something CLDCUnit-based) and spinning it off as a separate project. Such a framework is sorely needed in the BB development world, and would benefit greatly from being an active BB-focused project.