Unit Testing RCP Applications

Include Unit tests launching and stop in case of failure in a continuous integration process is a MUST. In the case of an Eclipse RCP application continuous environment process (based on ANT and PDE build scripts) set up we have to decide “how to install and launch unit tests“.

Solution: After building the RCP product, install the product using P2 director command line in the Eclipse SDK that has been used to build the product with a specific configuration. Then just launch the PDE unit test application as following:

 <java dir="./plugins" classname="org.eclipse.equinox.launcher.Main" fork="yes" classpathref="equinox.launcher.class.path" maxmemory="512m">
 <arg line="-application org.eclipse.pde.junit.runtime.uitestapplication -port ${port} -testpluginname ${plugin} -classnames ${classes} ${config}" />

This solution is great but has a main drawback: We are not running the unit tests in the “final” environment but in an SDK environment that has been enhanced with our RCP product.  A better solution to my eye will be to enhance the RCP product with the few plugins required by PDE unit test application in order to be closest to the final environment when launching the tests.

I’am investigating on that ….. next episode coming soon !

Note: feel free to comment this post to bring your point of view and experiences about RCP unit testing.