u123
u123

Reputation: 16331

Mocking framework for osgi/eclipse applications?

I am looking for mocking framework to use in my osgi/eclipse test fragments. I have looked at:

http://www.jmock.org/download.html

but since its not osgi I need to convert it manually. I have tried to google for some mocking frameworks that works with osgi out of the box but have not been able to find any, does osgi developers not use mocking?

Upvotes: 1

Views: 346

Answers (2)

Gábor Lipták
Gábor Lipták

Reputation: 9776

Actually Mockito works quite good with OSGI applications, since it has OSGI manifest. You can simply add it to your target platform from the latest orbit repository. I managed to make Powermock also working for Eclipse Plugins and it is available as well as update site at https://code.google.com/p/powermock-osgi/

Upvotes: 0

kgiannakakis
kgiannakakis

Reputation: 104188

One solution will be to create mock objects of OSGi objects (like BundleContext and ServiceReference). You can use any mocking framework for this and of course you don't have to run the test in an OSGi container. This will be OK for simple scenarios.

If you want to test inside a container, you have the following options:

Upvotes: 2

Related Questions