Hi
I am using TestNG 5.10 for unit testing and Guice 2.0 for unit testing. I have been able to hook up Guice with TestNG using IObjectFactory and @ObjectFactory annotation and it is working well. I have a question about scopes and listeners.
I used the custom scope implementation from Guice's user guide to generate thread local instances to be injected (Here is the link ;
http://code.google.com/docreader/#p=google-guice&s=google-guice&t=CustomScopes) . The document states that to enter and exit the scope, the code should reside in a filter or an interceptor. I am implementing TestNG invoked method listener to enter and exit scopes. However, for the code to work, I need to inject the scope in my listener to start the seed and exit process.
This is what I am think may work. Please correct me if I am wrong. If I can get a handle to the ITestContext, i can get an reference to Guice injector stored as a context attibute. I can use the Guice injector to inject members into listener. I have looked through the code and can not figure out how I can get a handle to the reference. Can any one help?
Thanks,
Kartik