Our approach is to keep JUnit totally separate from OSGi, and I personally feel more comfortable with this.
I see unit tests as just that: UNIT tests. They should remain much lower level and should be, IMHO, unrelated to the full-blown OSGi runtime environment. That does not exclude OSGi replacing JUnit, but I think it's overkill to require a complete OSGi runtime for simple unit tests. We just use a simple mock service manager to do this, and it works for us. The only thing I don't like is that we need to add in the dependencies by hand. Would be nice to have more integration with the pom. Now, if we're talking about integration testing, that's another matter. By definition, bundles need to work together. Ideally, the integration tests should also test for various possible runtime conditions, such as what happens when a given service is not availalbe, etc. In this case, there needs to be some kind of integration with OSGi. However, the title of the mail says "Unit testing" and, in summary, unless I hear some good reason to do otherwise, I strongly feel that unit testing should be kept as a separate concern from OSGi. Cheers, Dave On Wed, 2006-11-08 at 17:38 -0500, Alex Karasulu wrote: > Nikunj Mehta wrote: > > How do you combine unit testing with bundle development? Is there a nice > > integration of JUnit and OSGI that is widely used for this? > > > > I find it a particularly thorny issue since both JUnit and OSGI assume > > complete control of the running process, class loading, object > > instantiation, and threads. > > This is a main concern of mine as well. I've brought it up a couple > times at the felix mailing list. > > I think there are some ideas floating around about building more of an > integration testing framework that can help test your service within the > confines of OSGi. > > Richard Hall had given me a few pointers on similar work over at > Knoplerfish. He also had some good ideas in the same general direction. > > Perhaps others can chime in as well so we can shed more light on this > this issue. Testing is very important to me. It's been one of the > major stumbling blocks for me in terms of completely adopting OSGi. > > Alex > > _______________________________________________ > OSGi Developer Mail List > osgi-dev@bundles.osgi.org > http://bundles.osgi.org/mailman/listinfo/osgi-dev _______________________________________________ OSGi Developer Mail List osgi-dev@bundles.osgi.org http://bundles.osgi.org/mailman/listinfo/osgi-dev