Search code examples
javajunitjava-me

How to run JUnit test cases for J2ME code on Eclipse


Has anybody run JUnit (I am not talking about JMUnit or J2MEUnit Test Frameworks) Test Framework on J2ME code to test its functionality? If so, then how?

I would like to run J2ME code as a Java Application and test it on my PC.


Solution

  • This can be accomplished in Eclipse by creating two separate projects. The first project is your main project running on Compiler compliance level 1.3 or 1.4 suitable for Java ME version. This will have all your Java code and MIDlets for your application. This is to be run as a Java ME MIDlet Application

    The second project will be a JavaSE project running on Compiler compliance level 1.5 or higher (use the latest version). This will have all the test suites and test cases for your main project. It will have a reference to your first project. This is to be run as a JUnit Application.

    That's it! And you're good to go. Thanks to a friend for helping me out on this!