- return

The company [formally worked for] has been using 'test driven development'/'unit testing' techniques for the last year with huge success creating code with less bugs that's easier to maintain, being the sole Blackberry developer has meant I've not been able to use this method of programming, junit is a popular unit test library for java but it depends on reflection which is unavailable for mobile java.

jmunit and j2meunit are two mobile unit testing projects which are currently merging and are supported in the new release of Netbeans (5.5) - unfortunately these are heavily reliant on the midlet framework extending the Midlet base class and making use of a screen system which differs in some fundamental ways to that of native Blackberry applications.

'bunit' (Blackberry Unit) is based on jmunit but heavily re-written for Blackberry, I'm currently packaging everything into a small library trying to bundle as much possible so the programmer will have to do a minimum amount of setting up to start unit-testing on Blackberry.

The image below shows a test of four functions, the first test is created using the code:

Assertion a = new Assertion();
public void testfeetToMeters() throws AssertionFailedException {
float result = DistanceConversion.feetToMeters(25);
a.assertEquals("feetToMeters", 7.62F, result);
}

This is calling 'assertEquals' in our unit-test library, we pass the name of the test, the correct expected answer and the result of the function we're testing.

Sourceforge Project Page



Testing four methods with one fail.