Thanks for the reply. However, I still think that the problem is not
descriptive enough for everyone to understand, so I am giving an
example:
imagine my parent class is parentTest:
class parentTest() extends RemoteWebDriver{
@BeforeTest
public void beforeTest(){
......
URL url;
Capabilities capabilities;
RemoteWebDriver driver = new RemoteWebDriver(url, capabilities);
......
}
@AfterTest
public void afterTest(){
[I want to call driver.quit(); here but how to pass the one I
instantiated from @BeforeTest to @AfterTest?]
}
}
and my child class is childTest:
class childTest() extends parentTest {
@Test
public void realTest(){
[I want to use the driver defined in the @BeforeTest here, but how do
I pass it in? driver is not a static variable and it should be not
because I am running testng parallel executino to the test]
}
}
hope this describes the problem well enough.
Thanks everyone for offering help :)
On Sep 1, 7:34 pm, Krishnan Mahadevan
<
krishnan.mahadevan1...@gmail.com> wrote:
> If you have access to your parent class then you can very well introduce the
> @AfterTest and include this there.
> If you don't have access to it, you can have a @AfterTest method in your
> class and AFAIK the @AfterTest in your class should get invoked too.
>
> Thanks & Regards
> Krishnan Mahadevan
>
> "All the desirable things in life are either illegal, expensive, fattening
> or in love with someone else!"
>
>
>
>
>
>
>
> On Fri, Sep 2, 2011 at 5:05 AM, Danny Guerrier <
dguerr...@gmail.com> wrote:
> > Make the driver a protected variable in the parent class and you child
> > class will have access to it.
>