0

I am trying to create a threadLocal webdriver.

Trying to initialize and login into over application in @BeforeClass.

@test is having functionality. This test is working properly but whenever i use @test(timeOut=1200) it is getting failed due to timeOut's in Testng run on a different thread.

But whenever there is a timeOut in the @test(timeOut=1200) TestNG is creating Two new thread for the @beforeclass and @test.

Is there a possibility that it will run in a single thread.

I have tried TestNG-7.0.0-beta1 with -Dtestng.thread.affinity=true JVM agrument. But it stills fails to fulfill my requirement.

Thanks, balraj

1 Answers1

0

As of the latest released version of TestNG viz., 7.0.0-beta1, this is currently not supported within TestNG. Whenever you specify a timeout attribute for an @Test method, TestNG spawns it in a separate thread so that it can enforce timeouts.

But this behavior is applicable only for the @Test method and not for

  • the listeners (either the IInvokedMethodListener provided beforeInvocation() (or) afterInvocation()) (or)
  • for the configuration methods such as @BeforeMethod (or) @AfterMethod annotated configurations

[ These are the only set of methods which TestNG usually runs on the same thread as the @Test method ].

This issue as you are also aware is being tracked via https://github.com/cbeust/testng/issues/914

Krishnan Mahadevan
  • 14,121
  • 6
  • 34
  • 66