Skip to content

Is the JUnit 4 Timeout rule supported with the Vintage engine? #2280

@Vazzilena

Description

@Vazzilena

Hey,

Is junit4 timeout rule supported with the vintage engine?

We are experiencing an issue similar to #1742 when we started migrating to junit5 runners and switched to junit-platform-console-standalone-1.6.0-RC1.jar.

My impression is that old junit4 tests will be working out of the box with the junit vintage engine.

What we observe:

JUnit4's FailOnTimeout rule would create a separate thread group and thread to run the test in (including any other rule's before()/after()) : https://github.com/junit-team/junit4/blob/master/src/main/java/org/junit/internal/runners/statements/FailOnTimeout.java

JUnit5 does it differently, and it would try to run rule's after() statements on its own (in its own main thread). This results in rule's before() and after() statements run in separate threads and run in parallel which must not happen and eventually causes IllegalThreadStateException in our tests.

Is there a way to workaround this without having to migrate all the tests to junit5?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions