Test cases getting skipped with Selenium WebDriver using TestNG framework -
i using selenium webdriver
testng
framework running test suite on windows , mac platform on different browsers - chrome, ie, firefox , safari. have around 300 test cases in test suite.
the problem of test cases gets skipped in between believe driver becomes unresponsive. logs failed capture details why test cases getting skipped.
the reporter class
extends testlisteneradapter
, hence skipped test cases gets listed in log file use of onconfigurationskip
method. prints particular test case has been skipped.
below code snippets reference
code reporter class
@override public void onconfigurationskip(itestresult testresult) { logger.info(string.format("skipped configuration : %s", testresult.getmethod().getmethodname())); }
sample test class
public class testclass { private webdriver driver; @parameters({ "platform", "browser"}) @beforeclass public void setup(string platform, string browser) { // creates new driver instance based on platform , browser details driver = webdriverfactory.getdriver(platform, browser); // login web application utils.login(driver, username, password); } @test public void sampletestmethod() { // scripts validating web elements } @afterclass public void teardown() { driver.quit();; } }
observations:
driver.quit()
doesn't guarantee driver instance has been closed because can still see driver instance running in task manager. again intermittent , happens only.this issue observed on platform , browser
this intermittent issue , probability of occurrence increases number of test cases increase in test suite
there no definite pattern of skipped test cases. test cases randomly skipped on browser , platform
the probability of occurance of skip test cases increases subsequent run of test suite. believe reason more , more driver instances not closed keep running in ground
normally test class has 5-15 test methods , new
driver
instance created every time in@beforeclass
method , closed in@afterclass
any suggestions? in advance
the common reason test cases getting skipped selenium using testng if methods dependent on other method , method depend on failed.
Comments
Post a Comment