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

Tibor Digana edited comment on SUREFIRE-1373 at 5/13/17 10:15 AM:
------------------------------------------------------------------

[~apache-bugzi...@sebastian-kirsch.org]
[~sebastiankirsch]
I will explain and I want to have your feedback. I want to make sure I 
understand your problem.
You configure parameter {{parallel}}. So you do it with a purpose to speed up 
the execution. The annotation {{@NotThreadSafe}} executes all such classes in 
one particular Thread. So it means you have two groups of threads: a bunch of 
parallel Threads, and one single Thread running another bunch of classes one by 
one. This is expected. Please confirm {{@NotThreadSafe}} classes are executed 
one by one in a sequence. These two groups do not necessarily mean they have to 
run in a sequence. They can run in parallel which is the purpose to speed up 
the test-set execution. What matters is that tests which cannot run in multiple 
threads, because they and their classes are not threadsafe, are isolated in 
single Thread.


was (Author: tibor17):
[~apache-bugzi...@sebastian-kirsch.org]
[~sebastiankirsch]
I will explain and I want to have your feedback. I want to make sure I 
understand your problem.
You configure parameter {{parallel}}. So you do it with a purpose to speed up 
the execution. The annotation {{@NotThreadSafe}} executes all such classes in 
one particular Thread. So it means you have two groups of threads: a bunch of 
parallel Threads, and one single Thread running another bunch of classes one by 
one. This is expected. Please confirm {{@NotThreadSafe}} classes are executed 
one by one in a sequence. These two groups do not necessarily mean they have to 
run in a sequence. They can run in parallel which is the purpose to speed up 
the test-set. What matters is that tests which cannot run in multiple threads, 
because they and their classes are not threadsafe, are isolated in single 
Thread.

> 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
>
> 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
(v6.3.15#6346)

Reply via email to