apache / apache/maven-surefire
[SUREFIRE-1373] Tests annotated with @NotThreadSafe are not executed in isolation
- Dominant language
- Java
- Stars
- 461
- Forks
- 588
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 19
Description
**[Sebastian Kirsch](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=sebastiankirsch)** opened **[SUREFIRE-1373](https://issues.apache.org/jira/browse/SUREFIRE-1373?redirect=false)** and commented
The [surefire documentation](http://maven.apache.org/components/surefire/maven-failsafe-plugin/examples/fork-options-and-parallel-execution.html) states that
> you can apply the JCIP annotation `@net`.jcip.annotations.NotThreadSafe on the Java class of JUnit test (pure test class, Suite, Parameterized, etc.) in order to execute it in single Thread instance. The Thread has name maven-surefire-plugin@NotThreadSafe and it is executed at the end of the test run.
However, the thread is run in parallel to the other tests being executed, which contradicts the documentation and defeats the purpose of running tests sequentially in a single thread.
See https://github.com/sebastiankirsch/surefire-nonthreadsafe for a test case.
---
**Affects:** 2.20
0 votes, 11 watchers
Contributor guide
Research direction
Start with the Surefire documentation page on fork options and parallel execution and the reproduction at github.com/sebastiankirsch/surefire-nonthreadsafe. Trace how tests annotated with @net.jcip.annotations.NotThreadSafe are scheduled, then verify that the dedicated thread runs after the other tests rather than concurrently. Done means the documented isolation behavior is demonstrated by the reproduction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100