Skip to content

Tests never finish if helper throws exception while executing parallel tests #3238

@idontusenumbers

Description

@idontusenumbers

Steps to reproduce:

  1. Create new gradle project using testng, a sample test which uses a helper that throws an exception
  2. Use a testng.xml suite file to enable parallel execution
  3. Run tests

Expected result:
Tests finish running

Actual result:
Tests never finish running

Toward the end of running tests, I get this stack trace:

Exception in thread "TestNG-test-TestNGDemo-1" java.lang.NullPointerException: Cannot invoke "org.testng.thread.IWorker.getTasks()" because "worker" is null
	at org.testng.internal.thread.graph.GraphOrchestrator.setStatus(GraphOrchestrator.java:116)
	at org.testng.internal.thread.graph.GraphOrchestrator.afterExecute(GraphOrchestrator.java:75)
	at org.testng.internal.thread.graph.TestNGFutureTask.done(TestNGFutureTask.java:34)
	at java.base/java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:434)
	at java.base/java.util.concurrent.FutureTask.setException(FutureTask.java:303)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:322)
	at org.testng.internal.thread.graph.TestNGFutureTask.run(TestNGFutureTask.java:22)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)

Even more frustratingly, the stack trace that indicates the helper failed is often logged way before the NullPointerException.

Using latest 7.11.0

I've attached a sample project that demonstrates the issue.

testngdemo.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions