Headless Build – Final Step

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

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

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.



5 thoughts on “Headless Build – Final Step

  1. Pingback: f!@#!!! jar in jar files « Manuel Selva’s Eclipse blog

  2. Hello Manuel,

    even if your article is a little bit old I am searching excactly what you ‘ve done already. The integration of the headless build with junit tests.

    Can you give me a hint or guide me to how I can achieve this. I am stuck in how I can call my junit tests from pde build process.
    My project is organized in the following order:
    – 1 plugin
    – 1 feature
    – 1 test-plugin containing basic junit tests (no “plugin” tests)
    – 1 test-feature
    1 project holding my .map and .product file

    I have already my headless build running but do not know how to continue. Should I integrate the test-feature into my product or can I separate the real product from the test product?

    Any help would be great :-)


    • Hi Andreas,

      In my case, I first build my main feature calling PDE build scripts and install it in a clean fresh eclipse installation. Then I build and install the test feature always using PDE build scripts, and I customized this scripts (in the customTarget.xml) in order to finally (in postPackage) launch the test suite by running the org.eclipse.pde.junit.runtime.uitestapplication application. Try to google this application “org.eclipse.pde.junit.runtime.uitestapplication” and will get help on that.

  3. Hi Manuel,
    thx for the hint but unfortunately I was not able to find a good example. Maybe I have a problem in clearing my problem.
    When my current pde headless build is done, I have a directory containing the features, plugins of my product as well as the executable product as a zip file.

    I integrated the test-feature in my .product file to enable the expor as well. I also have a test.xml in my build directory which I call from the customTargets.xml – postBuild-Target. But as I am using eclipse 3.5 with junit4 I do not know how to configure the call to my junit-tests in my test-plugin.

    My questions are:
    – Are you using junit 3 or 4?
    – how do you build your product and/or test-product? Are these two products or is the test feature integrated in the product?
    – Can you provide an example what I do need for calling the unit tests and how this could be achived?

    Would be great if you could help me out.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s