mukil
unread,May 24, 2012, 8:25:55 AM5/24/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to testng-users
How do i create and destroy thread local object using TestNG.
Scenario :-
I have browser object created for every test method , i do
not want to create explicitly inside test methods, instead i want to
create & destroy using BEFOREMETHOD and AFTERMETHOD how do i achieve
this. Below code works fine in a Single thread , but when i execute as
parallel-method it fails
@BeforeMethod()
public void bm(ITestContext context){
context.setAttribute("BROWSER",new Browser());
}
@Test
piblic void mytest(ITestContext context){
....
.... access browser obj
}
@BeforeMethod()
public void bm(ITestContext context){
context.setAttribute("BROWSER",null);
}