kroe761
kroe761

Reputation: 3534

TestNG - execute method or fail if tests take too long?

I have a set of maybe 500 selenium tests using the TestNG framework.

Occasionally, a particular test will hang for no apparent reason (see my last question) which will stop the tests from proceeding further.

If I manually close the browser, then that test will fail and the tests will resume. I have a way to restart the browser if such an instance occurs, but I need a way for my code to know if it happens.

My best guess would be a timer where if a particular test takes longer than 15 minutes to execute I can just kill the browser, but I can't find a way to continually monitor each test for that trigger.

Upvotes: 0

Views: 764

Answers (1)

Ori Marko
Ori Marko

Reputation: 58772

You can use timeOut annotation, see tutorial, for example :

@Test(timeOut = 2000)

Upvotes: 1

Related Questions