RE: Second Test fails on TestNG test suite

Just curious to know that anybody else has faced the issue with TestNG xml, that the first test runs perfectly fine but second test of the test suite fails. Running test using testng xml

The issue is that the testng is trying to run the second test on the driver which was opened in the first test case. Even though the first driver was opened and closed in the first test case itself and a new driver instance is opened in the second, still it is ignoring the second driver.

Root cause is Testng xml passing the first driver to second test case internally.

<suite name="First Suite" >

<test name="InjuryBenfCal" >


<class name="testCases.InjuryBenfCal_001" />

<class name="testCases.InjuryBenfCal_002" />



Lakshay Sharma Professor Asked on October 29, 2014 in Selenium WebDriver.
Add Comment
2 Answers

this happens even if you use @Beforetest and @Aftertest or @Beforeclass and @Afterclass instancess also?

Supporter Answered on October 30, 2014.

Yes Bheem, I have tried every possible combination of annotations.

on October 30, 2014.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.