Skip to content

Extending J2MEUnit to publish the results

As those who use j2meunit to automate their testing already know, the problem is with viewing the results and gathering them, when tests run on real handset.

So I had to extend the original j2meunit to submit results to the server.

I had to create a new test runner that extends the j2meunit.midletui.TestRunner and overwrites siingle method, that is

/* (non-Javadoc)
* @see TestRunner#doRun(j2meunit.framework.Test)
*/
protected void doRun(Test suite) {
super.doRun(suite);
addToResultsList("Sending test results to the server.");
sendResultsToServer(aResult);
}

In the sendResultsToServer(TestResult result) all you have to do is gather the information you need from result, such as runCount(), errorCount(), failureCount() and go into details of iterating through result.errors() and result.failures(). In my case I send the over to the webserver as HTTP POST.

technorati tags:

Post a Comment

You must be logged in to post a comment.