Here is my situation.
Before my tests are run, in the beforesuite, I instantiate a bunch of "environment objects" These objects get created based on my environment configuration file. It is my tests that will actually be using these environment objects. The problem is how can I pass them to the tests.
Your first impulse might be to use a data provider, which will pass the correct objects to the test. The problem is that the data provider will have to know how to refer to the correct objects and then pass them. As it stands now the environment objects can only be referred to by name (string -> object)
My other option is to pass the test method a string which refers to the correct objects. But this has the same problem as above.
Both of these options create lots of dependencies and problems. I also have to make lots of assumptions about the type the key refers to.
Most of this problem stems from the fact that I abusing TestNG. What i really need is my own controller that can instantiate my Test object while passing the appropriate environment objects.
I was looking into testng s TestRunner interface, but I m not sure if this would work.
Any and all help appreciated. Eric