OSGi Testing

前端 未结 13 1057
执念已碎
执念已碎 2021-02-04 05:25

Currently, I am working on a new version control system as part of a final year project at University. The idea is to make it highly adaptable and pluggable.

We\'re usin

相关标签:
13条回答
  • 2021-02-04 06:00

    Treaty is a contract(testing) framework that is pretty academic but has some nice ideas. There are papers that are published on it, and the people currently working on improving it.

    0 讨论(0)
  • 2021-02-04 06:00

    There are many ways to test OSGi components, I suppose. One way of doing the testing is to use Robot Framework. What I've done is made my tests with Robot Framework and have the remote libraries either installed in OSGi or have them talk to OSGi-test components through sockets and robot would talk to these modules and run tests through them.

    So, basically your OSGi-modules should have interfaces that do something and produce some output. So, in my setup I had a test components that would make service calls to the actual OSGi-component and then there would be a listening-service that would catch the events/service calls (made by the module under test) and those results could be asked by the robot. So basically this way you can split a massive system in small components and have the system run in production/production like enviroment and have it tested automatically on component level or have some of the real components be tested in unison.

    0 讨论(0)
  • 2021-02-04 06:01

    For unit tests use the EasyMock framework or create your own implementations of the required interfaces for testing .

    0 讨论(0)
  • 2021-02-04 06:02

    Here are some tools not mentioned yet:

    • I'm using Tycho, which is a tool for using Maven to build Eclipse plugins. If you create tests inside their own plug-ins, or plug-in fragments, Tycho can run each set of tests inside its own OSGi instance, with all its required dependencies. Intro and further info. This is working quite well for me.

    • jUnit4OSGI looks straightforward. You make subclasses of OSGiTestCase, and you get methods like getServiceReference(), etc.

    • Pluginbuilder, a headless build system for OSGi bundles / Eclipse plug-ins, has a test-running framework called Autotestsuite. It runs the tests in the context of the OSGi environment, after the build step. But, it doesn't seem to have been maintained for several years. I think that many Eclipse projects are migrating from Pluginbuilder to Tycho.

    • Another option is to start an instance of an OSGi container within your unit test, which you run directly, as explained here.

    • Here's someone who's written a small bundle test collector, which searches for JUnit (3) tests and runs them.

    0 讨论(0)
  • 2021-02-04 06:06

    Eclipse has a launch configuration type for running JUnit tests in the context of an Eclipse (i.e. OSGi) application:

    http://help.eclipse.org/stable/index.jsp?topic=/org.eclipse.pde.doc.user/guide/tools/launchers/junit_launcher.htm

    0 讨论(0)
  • 2021-02-04 06:08

    How about bnd-testing-maven-plugin?

    It allow running JUnit inside a running container like Felix or Equinox. If you used the BNDTools for eclipse this is very similar but just maven withpout eclipse and without a UI.

    https://github.com/bndtools/bnd/tree/master/maven/bnd-testing-maven-plugin

    also look at the effectiveosgi archetype for maven. This will give you a good starting point to build your project or just add tests.

    https://github.com/effectiveosgi

    0 讨论(0)
提交回复
热议问题