bndtools / bnd

Bnd/Bndtools. Tooling to build OSGi bundles including Eclipse, Maven, and Gradle plugins.
https://bndtools.org
Other
527 stars 306 forks source link

remote.junit is a misnomer #2957

Closed kriegfrj closed 5 years ago

kriegfrj commented 5 years ago

Having gone through the documentation for biz.aQute.bnd.remote.junit, I can see that it is a very useful set of libraries for programmatically creating and launching OSGi environments. This would be very useful for testing bundle implementations (and in hindsight, I could have used it for some of my own tests rather than at least partially re-inventing the wheel).

However, I feel that the name is rather unfortunate and misleading. As the documentation itself notes, the code doesn't have any dependencies on JUnit. Really, it is a kind of generic mocking/faking test harness for OSGi. Naturally, it has some features that make it useful for testing OSGi bundles (including possibly within a JUnit context), but really its scope isn't limited to unit testing (much less to JUnit specifically) - you could potentially use it to dynamically spawn standalone OSGi environments in a live application.

Given the above, I suggest that it would be good to rename this bundle and its classes to something more accurate. For example:

Of course, depending on where this bundle is in the public release cycle, such a name change may not be feasible. I'll leave that judgement to other more experienced heads to consider.

pkriens commented 5 years ago

Well, I am a bit like humpty dumpty :-)

This is quite new and still in progress. I am working closely with a customer to iron out the bugs. Although the harness is super easy to use, the techniques to make this so easy are surprisingly complex.

Since you're not the only one making comments about the name I might consider renaming it. Though part of the reason is that I've not yet found a really good name. I like the JUnit aspect since it indicates java unit testing. After I've written documentation it should become more clear that you can also use it with other unit test frameworks. Since I expect it will become quite popular, I am not that worried that people will miss it once the documentation is in place.

But thanks for the feedback. Kind regards,

Peter Kriens

On 12 Feb 2019, at 07:18, Fr Jeremy Krieg notifications@github.com wrote:

Having gone through the documentation for biz.aQute.bnd.remote.junit, I can see that it is a very useful set of libraries for programmatically creating and launching OSGi environments. This would be very useful for testing bundle implementations (and in hindsight, I could have used it for some of my own tests rather than at least partially re-inventing the wheel).

However, I feel that the name is rather unfortunate and misleading. As the documentation itself notes, the code doesn't have any dependencies on JUnit. Really, it is a kind of generic mocking/faking test harness for OSGi. Naturally, it has some features that make it useful for testing OSGi bundles (including possibly within a JUnit context), but really its scope isn't limited to unit testing (much less to JUnit specifically) - you could potentially use it to dynamically spawn standalone OSGi environments in a live application.

Given the above, I suggest that it would be good to rename this bundle and its classes to something more accurate. For example:

Bundle biz.aQute.bnd.remote.junit -> biz.aQute.bnd.remote.harness or maybe biz.Qute.bnd.remote.framework Package aQute.bnd.remote.junit ->aQute.bnd.remote.harness or aQute.bnd.remote.framework Class JUnitFramework -> OSGiFramework or OSGiHarness Class JUnitFrameworkBuilder -> OSGiFrameworkBuilder or OSGiHarnessBuilder Of course, depending on where this bundle is in the public release cycle, such a name change may not be feasible. I'll leave that judgement to other more experienced heads to consider.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bndtools/bnd/issues/2957, or mute the thread https://github.com/notifications/unsubscribe-auth/AAMPLvrHPW58YyDpgurem10KaTtCmbPAks5vMlzPgaJpZM4a1rxU.

kriegfrj commented 5 years ago

Well, I am a bit like humpty dumpty :-)

In that you're sitting on a "wall" dividing the code-under-test from the test code? And if your code falls off either side of the wall, it's hard to put it back together again? :smile:

I am working closely with a customer to iron out the bugs. Although the harness is super easy to use, the techniques to make this so easy are surprisingly complex.

What you have said reminds me of a similar framework that I once worked with a few years ago for testing Android code - https://github.com/robolectric/robolectric. It makes unit testing Android projects very simple, but the test harness code itself was very complicated - lots of magic with custom classloaders, instrumenting class loaders, etc.

Since you're not the only one making comments about the name I might consider renaming it. Though part of the reason is that I've not yet found a really good name.

Well, you could either go with something simple but description that indicates its function (like "harness" or "framework"), or come up with something a bit more "cool & catchy" like Robolectric. How about OSGilectric or Bndlectric? ;) After all, OSGi already talks about "wiring up" bundles. :smile: When I worked with Robolectric, the internal name they had for the class that managed the simulated Android environment was ParallelUniverse, but it looks like they've changed that terminology to Sandbox more recently which would also be a pretty good choice.

Anyway, you're the author, the creator and the brains behind it - you absolutely deserve to have last naming rights. Just throwing out some suggestions. Look forward to using it!

pkriens commented 5 years ago

Ah, Father Krieg, you miss the classics! From Through The Looking Glass:

‘My name is Alice, but—’ ‘It’s a stupid enough name!’ Humpty Dumpty interrupted impatiently. ‘What does it mean?’ ‘Must a name mean something?’ Alice asked doubtfully. ‘Of course it must,’ Humpty Dumpty said with a short laugh: ‘my name means the shape I am—and a good handsome shape it is, too. With a name like yours, you might be any shape, almost.’

‘But “junit” doesn’t mean “a nice knock-down argument,”’ Alice objected. ‘When I use a word,’ Humpty Dumpty said in rather a scornful tone, ‘it means just what I choose it to mean—neither more nor less.’ ‘The question is,’ said Alice, ‘whether you can make words mean so many different things.’ ‘The question is,’ said Humpty Dumpty, ‘which is to be master—that’s all.’

I've decided to rename it to 'Launchpad' ... Seems pretty unique and has some reasonable semantic relation to what it is doing which will make it more mnemonic.

Kind regards,

Peter Kriens

On 13 Feb 2019, at 00:18, Fr Jeremy Krieg notifications@github.com wrote:

Well, I am a bit like humpty dumpty :-)

In that you're sitting on a "wall" dividing the code-under-test from the test code? And if your code falls off either side of the wall, it's hard to put it back together again? 😄

I am working closely with a customer to iron out the bugs. Although the harness is super easy to use, the techniques to make this so easy are surprisingly complex.

What you have said reminds me of a similar framework that I once worked with a few years ago for testing Android code - https://github.com/robolectric/robolectric https://github.com/robolectric/robolectric. It makes unit testing Android projects very simple, but the test harness code itself was very complicated - lots of magic with custom classloaders, instrumenting class loaders, etc.

Since you're not the only one making comments about the name I might consider renaming it. Though part of the reason is that I've not yet found a really good name.

Well, you could either go with something simple but description that indicates its function (like "harness" or "framework"), or come up with something a bit more "cool & catchy" like Robolectric. How about OSGilectric or Bndlectric? ;) After all, OSGi already talks about "wiring up" bundles. 😄 When I worked with Robolectric, the internal name they had for the class that managed the simulated Android environment was ParallelUniverse, but it looks like they've changed that terminology to Sandbox more recently which would also be a pretty good choice.

Anyway, you're the author, the creator and the brains behind it - you absolutely deserve to have last naming rights. Just throwing out some suggestions. Look forward to using it!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bndtools/bnd/issues/2957#issuecomment-462980747, or mute the thread https://github.com/notifications/unsubscribe-auth/AAMPLjNVVtJEFo5mI1VDcitTpEiCZNgtks5vM0vHgaJpZM4a1rxU.

bjhargrave commented 5 years ago

Closing since Peter has renamed the bundle and class.