Last week was a release week for our product. Thus I decided to complete my headless build with integration of the Unit Tests. Using this article I quickly got my Unit Tests integrated in my build. Fine !!!!

JUnit Tests - Console Results

I then decided to open the generated Html report in order to see 100% of successful tests in more readable view than the previous console screenshot.

Guess what …. the report was not “correctly” generated. All my tests were there with the correct result and the correct elapsed time but all the tests were grouped under one unique package and one unique class. I am already earing some of you saying : “It doesn’t matter, the important thing is that the build fails if tests fail”.

I am ok with that but I couldn’t close my long headless story with a problem even it this problem is more a detail than a real problem.

As a result, I decided to get my hands dirty and start reviewing the code providing with the article mentioned above. The class responsible for generating xml files that will be pass to junitreport task is the one called PDETestListener. The main work of that class is to listen on a given port the tests results sent by a PDE application responsible to run the tests.

The first thing I noticed with that class is the usage of PDE internal classes. After investigations it seems impossible to easily replace the use of internal classes … f@!1!#

An other problem I noticed with this listener is the lack of high level notifications. Even using internal classes PDE only provides notification about tests started, failed, ended …. with the test ID as String parameter.

After several tricks I was able to correctly generate an html report like this one (found on the web here) where packages and classes are correct !!!

JUnit Tests - Html reports

It was not easy to do to that and I said before a lot of “tricks” were used !!!

If you are interesting on doing the same thing or even better in having this at PDE level or at least in the Eclipse article feel free to comment or/and ask question in bugzilla here.