Re: Different configurations for different test class instances?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Different configurations for different test class instances?

Cédric Beust ♔
Hi Ataraxian,

Note that I'm CC'ing testng-users, and I suggest we continue the discussion there (your question is general enough).

On 12/6/06, Ataraxian <[hidden email]> wrote:

I hope someone here can help me find a clean solution to a kind of tricky TestNG problem.

I'm instantiating (programmatically) TestNG instances on a server in response to requests from multiple clients (via a web browser).  The test classes also all reside on the server.  The test class instances each require different configuration information (such as the URL to test against, where to store resulting data, and test run identification information) that is provided by each user from the user's web browser.  So I need to provide a different set of configurations for each TestNG instance for use by the test class instance created and run by each individual TestNG instance.  Is that at all clear?

Is there a way I can get a reference to my test class (perhaps from a listener) after it is created by the TestNG instance?  This would allow me to pass the configuration information to each instance of my test class.

Like Hani and Alexandru, I'm not 100% sure what you are trying to do (would love to see some code), so my answer might be a bit off base, but let me point out that if you declare your Data Provider as taking a java.lang.reflect.Method as its first parameter, TestNG will use this parameter to pass the test method about to be called.  This way, you Data Provider can return different values depending on which test method is about to be invoked.

Let us know if any of these suggestions help, and in the negative, please post some of your code...

Thanks!

--
Cédric
--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Loading...