Archive for the ‘ME Framework’ Category

ME Framework: One year in the open

Wednesday, November 14th, 2007

Exactly one year ago, ME Framework has been released to the public under GPLv2 license. A LOT happened during this first year in the open source. And here are the most notable events and milestones:

And most importantly, it was fun! :) OK, now on to the second year, with hope that it will be even crazier!

What’s new in ME Framework 1.2

Thursday, June 14th, 2007

We (the ME Framework team) are getting closer and closer to the release date of ME Framework 1.2, and I thought that it would be useful to provide a high-level list of most important changes, improvementns and new features that we implemented in this upcoming release.

  • New Test Export feature:
    • Export of Tests with the sources (CLDC and MIDP modes)
    • JAD files are now generated for exported tests (MIDP mode)
    • Produces Ant builds to easily rebuild the tests
    • Produces Netbeans projects (allows to easily modify, build, run and debug the exported test right from the Netbeans).
    • Distributed tests can now be exported too.
    • OTA provisioning server for exported tests (ISSUE #6)
  • New “Debug Agent” for MIDP, that provides tracing and debugging information on the device screen, i.e., the name of the currently executing test. This agent also alows to manually cancel long-running tests.
  • New “Debug Agent” in MIDP test export mode, alows to run the exported tests and to see and traverse the test results right on the device. (ISSUE #106).
  • Created test execution over generic/pluggable communication channel (in CDC mode only). This allows to execute tests with help of a new Agent that uses the pluggable CommToJavaTest service to communicate with the Javatest harness via variety of different protocols.
    • Standard Interview is updated as well
    • Added Serial line based communication
    • Added Socket-based communication
    • Also, HTTP- and UDP-based communications present as well
  • Major DTF (Distributed Test Framework) update.
    • Removed code duplication
    • Added support for CDC mode
    • See “DTF Update” in the Changelog for more details
  • Test Suite hierarchy updated: Introduced a service based TestSuite classes which delegate starting/stopping services to a service manager and corresponding service classes. Service classes are created for passive agent, Http, Https, CommService, messaging and test bundling.
  • Various performance improvements for the test execution in CLDC/MIDP mode (faster JAR file creation, faster signing, I/O buffering).
  • New DTF (distributed test framework) interview (ISSUE #72)
  • ME Framework’s standard Interview reorg:
    • Better Debugging options (ISSUE #2)
    • Better interview’s visualization
    • Fixed some interview usability and inconsistency issues (ISSUE #47)
  • Better identification of Framework JAR files implemented. Invoke java -jar j2mefw_jt.jar to see a list of all JAR files, with checksumms and the name of the version and the build. (ISSUE #97).
  • Better error messages in various places (ISSUE #73, ISSUE #84, ISSUE #78, ISSUE #170, ISSUE #168, ISSUE #159).
  • Moved common MIDP interactive and OTA classes to the framework (ISSUE 6407297).
  • Corrected Framework’s handling of the testsuite.jtt entities:
    • interview
    • finder
    • declaratively enabling DTF
  • Three Samples added
    • SimplestTestSuite (bare minimum to execute automated tests)
    • SimpleTestSuite (features automated and distrubuted tests in MIDP and CDC mode)
    • AdvancedTestSuite
    • The samples reside in the “samples” directory, and can be built as part of ME Framework build via “ant samples” command.
  • ME Framework JAR files can now be placed in any location, not “lib”, as was previously required.
  • SignatureTest Interview added.
  • Added common interview questions for CDC-based test suites.
  • Improvements in the TestBundler (CLDC and MIDP modes):
    • Improvements in handling of testClasses.lst (ISSUE #5064774)
    • The main test class is now being automatically bundled, there is no need to specify it in the testClasses.lst
  • Better out-of-box experience and better customization with ME Framework:
    • Better default values selected without the need to manually specify them (correct Script, depending on the test execution mode) ISSUE #174
    • BasicTckInterview is now much easier to customize and extend if needed
    • ISSUE #156: “Remote” test description filed should not be mandatory for distributed tests
    • ISSUE #157: Passive agent should be an optional component of the distributed test suite.
  • IPv6-related bugfixes (ISSUE #92, ISSUE #96, ISSUE #108)
  • Preverifier Interview added
  • Transition to JDK 5.
  • As usual, there were a lot of various bug fixes as well.

During the work on ME Framework 1.2, we’ve produced three “development” releases with snapshots of our current work. Here are the announcements with detailed change logs:

cqME and ME Framework bloggers

Tuesday, May 15th, 2007

Here’s a list of cqME, JT harness and ME Framework bloggers that I’m aware of:

Mikhail has just started blogging. Misha, welcome to the club. :)

ME Framework at JavaOne

Tuesday, April 17th, 2007

Come see us (ME Framework team) at JavaOne conference in San Francisco May 8-11 2007. We will be sharing our Java ME testing and testing tools experience at the technical session TS-5906 (”Building a Java ME Test Suite in 15 Minutes”) which is scheduled for May 9, 6:35 PM.

You can meet our team at Sun Microsystems booth #970 on the pavilion floor. Stop by to chat, discuss ideas, and see the demos.

Personally, I won’t be at JavaOne this year, I managed to break my arm (quite some time ago, so no worries) and now almost done with recovering. But plenty of our folks from Santa Clara and Saint Petersburg are going to be there.

Update: Terrence has quite a lot of additional info on Java ME at JavaOne.

Comparison of Java ME unit testing frameworks

Thursday, April 5th, 2007

With the recent ME Framework open sourcing, and with all those discussions on what ME Framework can do for application developers (as opposed to TCK writers), I took a look at the APIs for popular JUnit-like unit testing frameworks for Java ME, to see what we can do better in our ME Framework.

Please note that this comparison is focused mostly on the API.

Popular Unit testing framework for Java ME:

  1. J2MEUnit
  2. JMUnit
  3. Sony Ericsson Mobile JUnit 1.0

All three frameworks are close to the original JUnit, with adjustments needed to support the Java ME Platform. In all 3 cases, a test class should extend a base class from the appropriate framework. And all typical JUnit helper methods are provided to the subclasses, e.g.: assertTrue, assertFalse, assertEquals, etc. (J2MEUnit provides the bare minimum of such methods, leaving quite some of them out).

JUnit standard hook methods are also present: setUp() and tearDown(), to setup test environment and to tear it down after the test is done.

So, in all 3 cases, developers who are familiar with JUnit, can start writing new unit tests for Java ME with fewer problems, since they basically know the core API.

The differences can be seen in areas where support for Java ME was added (one of the major problems is the lack of reflection in Java ME, while the original JUnit relies heavily on it). While the tests themselves look pretty similar for all three frameworks, the way the test suites are constructed differs.

1. J2MEUnit

With absence of reflection, J2MEUnit authors decided that test suites should be created manually, explicitly adding new tests to the test suite, like this:

  aSuite.addTest(
      new TestOne("testOne", new TestMethod() {
          public void run(TestCase tc) {
              ((TestOne) tc).testOne();
          }
      })
   );

The name of the test provided in the constructor, and the functionality of the test is enclosed in the anonymous inner class that implements the TestMethod.

Pretty heavyweight and not that simple, if you ask me.

2. JMUnit

JMUnit test class must call a two-parameters constructor of the base class, specifying the number of the “sub”-tests, and the name of the test.

public TemperatureConversionTest() {
    super(4,"TemperatureConversionTest");
}

The test selection and execution is done via method test(int), that should be implemented by every test:

public void test(int testNumber) throws Throwable {
    switch(testNumber) {
        case 0:testfahrenheitToCelsius();break;
        case 1:testcelsiusToFahrenheit();break;
        case 2:testisHotter();break;
        case 3:testisCooler();break;
        default: break;
    }
}

The base class will call this method with all int values, from 0 to number-of-tests.

In my opinion, this approach is less convoluted and more straightforward then J2MEUnit. JMUnit also provides better GUI on a device that shows the results.

JMUnit provides two versions, one is suitable for CLDC 1.0, and the another one is for CLDC 1.1.

Overall, JMUnit provides more extensive set of helper methods (asserts), with better GUI, and with more straightforward configuration.

Netbeans’ Mobility Pack has switched from J2MEUnit to JMUnit recently.

3. Sony Ericsson Mobile JUnit 1.0

The folks from Sony Ericsson did an excellent job on this, providing good extension to JUnit for Java ME, and with great documentation :)

Sony Ericsson approach, it seems, was to provide experience as close to original JUnit as possible. In most cases, to port JUnit tests to Sony Ericsson unit tests is just a matter of replacing the base test class all the tests extend (from JUnit one to Sony Ericsson one.)

Couple of innovative things were done in this library. The absence of reflection is handled on Java SE side, where the tests are being analyzed and proper extra classes are created, so that developers are freed from manual work of specifying all their test names. Sony Ericsson’s version is clearly better here then the two alternatives (J2MEUnit and JMUnit).

The library also provides nice additions on top of typical JUnit API. For example, it not only provides setUp() method, but also setUp(MIDlet midlet), for those tests that would like to access the midlet that runs the tests.

The GUI on the device looks nice too, with tabbed interface for passed/failed tests. Sample project for WTK is also provided. And the basic code coverage can be calculated, which is an unexpected plus.

Integration with Ant, NetBeans and Eclipse is provided.

Overall, Sony Ericsson Mobile JUnit 1.0 is very well done and easily beats other alternatives, discussed above. They provide the best JUnit “emulation”, and resolve absence of reflection in innovative way simplifying developers life.

For additional information, take a look at the following article: “JUnit Testing Using Java ME JUnit Frameworks“.