Skip to content

Test timeouts swallow stack traces #2765

@idontusenumbers

Description

@idontusenumbers

TestNG Version

7.5 (I see 7.6 was just released but it doesn't appear this behavior will change, see below)

Expected behavior

The result of test timeout allows the developer to identify which line of the test method was executing when the timeout happened

Actual behavior

The InterruptedException thrown by the JVM on the test thread is replaced with a fresh TimeoutException with no reference to the InterruptedException, clobbering all evidence of where the test timed out.

Is the issue reproducible on runner?

  • Shell
  • Maven
  • Gradle
  • Ant
  • Eclipse
  • IntelliJ
  • NetBeans

Test case sample

Please, share the test case (as small as possible) which shows the issue

Contribution guidelines

Here's the offending line; I suspect passing the InterruptedException as the cause of the ThreadTimeoutException would be a great solution.

https://github.com/cbeust/testng/blob/523923ef7eaa83bebf9f607b94d51a716685b4d5/testng-core/src/main/java/org/testng/internal/invokers/MethodInvocationHelper.java#L360

would become

e = new ThreadTimeoutException(tm, realTimeOut, e); 

And that ThreadTimeoutException constructor overload would need to be overloaded again to take a cause.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions