apache / apache/maven-surefire

[SUREFIRE-1745] Global Junit Test timeout

Open
#3,106 11 comments 0 reactions 0 assignees View on GitHub
enhancement priority:major
Dominant language
Java
Stars
461
Forks
588
Avg merge
1d 8h
Merged PRs (30d)
19

Description

**[Kishore Kumar](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=kishoretak)** opened **[SUREFIRE-1745](https://issues.apache.org/jira/browse/SUREFIRE-1745?redirect=false)** and commented

Hi,

We need unit test level time-out similar to this https://github.com/junit-team/junit4/wiki/Timeout-for-tests  in surefire where we can configure a timeout similar to _parallelTestsTimeoutForcedInSeconds_. 

Also, I've observed that _parallelTestsTimeoutForcedInSeconds_ is not able to stop the infinite loop kind of test, and for other kinds of test even after timeout error in the log, the test is marked as successful in the surefire report.

 

Can we have something similar to Junit timeout in surefire where we can configure global test timeout which will only stop that particular test which takes more than configured time and mark it as timeout error in the report, without impacting/stopping any other test's execution?

```java
@Test
public void infiniteLoop(){
while (true) {}
}

```

---

**Affects:** 3.0.0-M4

Contributor guide

Open the contributing guide

Research direction

The issue names Surefire's parallelTestsTimeoutForcedInSeconds setting and the Surefire report but no repository files or tests. Start by tracing the existing timeout behavior and reviewing the issue discussion; done means a configurable global timeout stops only the overlong test, marks it as a timeout error, and leaves other tests running.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.