You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Alexandra (Jira)" <ji...@apache.org> on 2021/03/30 15:22:00 UTC

[jira] [Commented] (SUREFIRE-1373) Tests annotated with @NotThreadSafe are not executed in isolation

    [ https://issues.apache.org/jira/browse/SUREFIRE-1373?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17311575#comment-17311575 ] 

Alexandra commented on SUREFIRE-1373:
-------------------------------------

I'm experiencing the same issue with surefire 3.0.0 M3, we have some tests that perform some DB update, and have isolated them with @NotThreadSafe, however even if they properly run in a single thread but in parallel with other tests which creates failures in the other tests due to DB updates.

I, too, was surprised as documentation seem to indicate that the notthreadSafe tests will be run +after+ all other threads are done.

is there any chance this will be implemented ?

> Tests annotated with @NotThreadSafe are not executed in isolation
> -----------------------------------------------------------------
>
>                 Key: SUREFIRE-1373
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1373
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: Maven Surefire Plugin
>    Affects Versions: 2.20
>            Reporter: Sebastian Kirsch
>            Assignee: Tibor Digana
>            Priority: Major
>             Fix For: Backlog
>
>   Original Estimate: 48h
>  Remaining Estimate: 48h
>
> The [surefire documentation|http://maven.apache.org/components/surefire/maven-failsafe-plugin/examples/fork-options-and-parallel-execution.html] states that 
> bq. 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.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)