Probably the biggest issue I have when trying to write "integration tests" is reliability, ensuring that everything that needs to be running and wired together is running and wired together before the test starts.
So I'm writing "integration tests" using an OSGi enRoute project with a ".test" suffix, and running with the "Bnd OSGi Test Launcher (Junit)" runner.
Because of the asynchronous nature of how the SCR works relative to the launcher, there's no guarantee that when my test starts running, that all components are activated and fully wired together. Sometimes it works, sometimes it doesn't.
I have been using the Amdatu testing configurator, which works up to a point, but it always seems a bit unsatisfactory. To completely describe all of the services that the test needs to wait for before it can run would potentially require dozens of steps, and there's no guarantee that I'd capture them all anyway. It may seem like it's working, but maybe I've forgotten one, and once in a while the tests fail because that service hasn't been properly activated yet, who knows.
Haven't I already expressed what components I need before testing can start by listing them in the "run requirements" in the bnd file? Why would I then want to list them all all over again?
Is there any way of telling that the SCR has done everything it needs to do, it's got nothing outstanding left to do (I'm assuming it's the SCR I'm interested in here, I'm using DS)? Is there some kind of listener that I can get some notification from? I had a quick look in the OSGi compendium specification, but couldn't see anything obvious, but I admit to not having read all 1600 pages :-)
It seems an obvious enough thing to want to do, and it seems like a reasonably enough thing to define, that there's nothing outstanding left to do, "activation" and "wiring" wise.
Any suggestions?
Thanks.