Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

JUnit Testing Using Java ME JUnit Frameworks

Just because Java Micro Edition lacks reflective capabilities doesn't mean Java Micro Edition developers miss out on the advantages of JUnit styled testing. JUnit-styled frameworks and tools can still improve ME application quality.


advertisement
Unit tests have become a staple part of most Java Standard Edition (SE) and Enterprise Edition (EE) applications—especially those that espouse test-driven development. Kent Beck and Eric Gamma's original Smalltalk framework has become so popular and successful that it has been ported to a wide variety of programming languages to include Ada (AUnit) C# (NUnit), Python (PyUnit), and even Fortran (fUnit). Arguably, Java's JUnit has been the most successful of all unit testing frameworks and has generated many JUnit offspring, in the form of extensions, to help unit test everything from multi-threaded Java applications to high powered enterprise Java applications.

However, using JUnit or finding a JUnit extension for use in Java Micro Edition (ME) development has been a little tough. JUnit frameworks rely on Java reflection. Since the reflective API is not present in Java ME environments, typical JUnit tools, which rely heavily on reflection, do not help. In spite of this, there are two (soon to be one—more on this in a bit) Java ME JUnit extensions built especially for device application developers. Importantly, NetBeans and the NetBeans Mobility Pack plan on incorporating a Java ME JUnit-style framework with the release of NetBeans and NetBeans Mobility 5.5. The IDE provides a neat capability to add unit testing to your ME applications very quickly.

This article introduces you to JUnit testing using Java ME JUnit frameworks; where to find them, how to test with them, and how to use them to build better quality software.



Where to Get a Java ME Unit Test Framework
Today, there are two Java ME JUnit test frameworks available. They are J2MEUnit and JMUnit. Both projects are open source frameworks available in a single download file via SourceForge.net.

However, the project administrators of these two open source projects (Elmar Sonnenschein and Brunno Silva, respectively for J2MEUnit and JMUnit), plan to merge their two frameworks into one. The new project will be consolidated under the J2MEUnit project moniker. According to Sonnenschein, "because of the larger existing user base the resulting project will be hosted under the J2MEUnit name at SourceForge. We're planning to create a J2MEUnit 2.0 release from Brunno's JMUnit 2.0 codebase." In a recent correspondence with Silva, he indicated that completion of the merged product and a 2.0 release will probably not be completed this year. Don't let the merged project stymie plans to incorporate unit testing into your micro edition application. Silva further suggested that the projects did not "want to break the code of the current users of both frameworks, so the original code is going to be presented, but deprecated. The united framework shall bring features of both, JMUnit and J2MEUnit."



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap