Like the Rational tools, Libra integrates with Eclipse's existing web, JPA , and OSG i
tools rather than re-inventing wheels. This makes both tools attractive options if
you're used to using Eclipse for your Java EE development. At the time of writing,
Libra is still an incubator project in the early phases of development, but it has signifi-
cant promise as a development tool.
A good IDE isn't a substitute for a good automated build system—instead, your IDE
and your build system should work together. When chosen well, an IDE and an auto-
mated build complement each other, making code easier to write and debug. The
same principles apply to testing code—for all but the smallest projects, you'll need
some sort of automated testing. But you'll find your development process a lot slower
if these tests can only be run from your automated framework.
Testing OSGi applications inside IDEs
In chapter 8, we mentioned that getting the runtime environment for your tests right
can sometimes be as tricky as getting your tests functionally correct. A good IDE setup
will allow you to run your tests so that you can debug the tests themselves, debug auto-
mation problems, and also debug your application.
Testing with Eclipse PDE
If you're using PDE for your development, you'll find it natural to run the tests in PDE
as you write them. If you have the target platform set up to mirror your runtime envi-
ronment, integration testing inside Eclipse PDE is simple. After you've written your
unit tests, running them is a matter of right-clicking and choosing Run as > JU nit Plug-
in Test (see figure 9.21).
Results are presented in the same form as any other JU nit tests run from Eclipse
(see figure 9.22).
So far, so convenient. PDE 's test environment will allow you to run your integration
tests and debug problems with your tests and applications. The one thing missing is
deep integration with a command-line build system. If you're using Tycho as your
build system, you'll find that Tycho and PDE use a different system for working out
which bundles to include in the runtime environment. This means that the auto-
mated tests may not be running with exactly the same set of bundles as you're using
inside PDE , and in the worst case, this will cause behavior differences. PDE will launch
your entire target platform when it runs tests, whereas Tycho will carefully provision a
minimal runtime platform. Instead of launching every bundle it knows about, it will
Figure 9.21 Eclipse allows unit tests to be run in an OSGi framework from within the IDE using a simple
menu option. The target platform is used to generate the list of bundles to install in the OSGi framework.
Search WWH ::