@Test@Injectpublic void test1(MyPerThreadResource resource) {// use resource}
@BeforeClass@Injectpublic void beforeClass(MyThreadResource resource) {this.resource = resource;}
--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to testng...@googlegroups.com.
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
Jeff-351 wrote:
>
> ...not trying to be too big of a pain, but any thoughts/discussion on
> possible ways to handle this?
>
> One specific question that I still don't know ... if my class is
> singleThreaded=true, is there a guarantee that the @BeforeClass method
> will
> be called on the same thread as all the other @Test methods in the class?
>
> If so, I think I just need to inject the resouces in the @BeforeClass
> method
> with a custom Guice Module that handles detecting/retrieving the resource
> based on thread.
>
> Has anyone else wrestled with this? I'm curious how you handle
> thread-specific resources.
> On Wed, Oct 5, 2011 at 11:38 AM, Jeff <preda...@gmail.com> wrote:
>
>> The resource in question is a Selenium2 WebDriver object.
>>
>> The @Tests in my test class(es) represent a sequence of steps in a
>> workflow/use case that must be executed in a pre-determined order using
>> the
>> same WebDriver object (browser window). I've set each class to run
>> 'singleThreaded=true' and use the dependsOnMethods to chain the @Test
>> methods *(sidenote: is there a less maintenance heavy way to chain
>> dependent test cases --- say alphabetically by name?)*.
>>
>> In the past, I've used two approaches:
>>
>> 1. Each class creates it's own WebDriver object, where the class was
>> responsible for the setup/teardown of the driver (which launches a web
>> browser). This process is fairly expensive to do for each class.
>> 2. Implement a custom WebDriver factory that would return the driver
>>>> I ♥ DropBox <http://db.tt/9O6LfBX> !!
>>>>
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups
>>>> "testng-users" group.
>>>> To post to this group, send email to testng...@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> testng-users...@googlegroups.com.
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/testng-users?hl=en.
>>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups
>>> "testng-users" group.
>>> To post to this group, send email to testng...@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> testng-users...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/testng-users?hl=en.
>>>
>>
>>
>>
>> --
>> Jeff Vincent
>> preda...@gmail.com
>> See my LinkedIn profile at:
>> http://www.linkedin.com/in/rjeffreyvincent
>> I ♥ DropBox <http://db.tt/9O6LfBX> !!
>>
>>
>
>
> --
> Jeff Vincent
> preda...@gmail.com
> See my LinkedIn profile at:
> http://www.linkedin.com/in/rjeffreyvincent
> I ♥ DropBox <http://db.tt/9O6LfBX> !!
>
> --
> You received this message because you are subscribed to the Google Groups
> "testng-users" group.
> To post to this group, send email to testng...@googlegroups.com.
> To unsubscribe from this group, send email to
> testng-users...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/testng-users?hl=en.
>
>
>
--
View this message in context: http://old.nabble.com/Guice-Constructor-Injection-with-TestNG-tp32593158p33545044.html
Sent from the testng-users mailing list archive at Nabble.com.