Mobile Unit Testing
July 1, 2008 by ovidiuWikipedia tells us that “unit testing is a test (often automated) that validates that individual units of source code are working properly. A unit is the smallest testable part of an application.” What this means is that every time you change something in you code, or do something that might affect the behavior of your application, all you have to do is run the test suite and you’ll have an immediate answer to the question “does my change break the application or not?”.
In the Java world, unit testing is synonymous with JUnit. While JUnit is written in pure Java, it makes use of certain features not available on J2ME, such as the Reflection API. While you cannot use JUnit for J2ME unit testing, suites do exist for J2ME that mimic the behavior of JUnit to a very large degree. Going from Java unit testing to J2ME unit testing is a matter of minutes, and is easy as pie.
On one hand, we have Mobile JUnit, from Sony Erricson. This testing suite, created and endorsed by the famous phone manufacturer, is specifically tailored for SE phones, but should work on all J2ME-enabled phones and emulators. It closely mimics JUnit, and while by default it is a standalone release, it can be integrated with development tools such as Eclipse.
And on the other hand you have JMUnit and J2MEUnit. These two projects have announced a merger, and are so similar that I’ll treat them as one. Again, they closely mimic JUnit. However, while they lack support from a large phone manufacturer, they are high-quality and open-source. Furthermore, JMUnit is integrated with the NetBeans Mobility Pack. This means that, while using NetBeans, developing unit test for J2ME is as easy as developing them for Java. And this is a big plus for me, since I use NetBeans.
In the end, the important thing is that you have a choice. Three (soon to be two) very good JUnit counterparts for the mobile world means that there is room for competition and improvement, which is good for us developers. My personal choice at the moment is JMUnit, because of it’s integration with NetBeans.

You must be logged in to post a comment.