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

Tibor Digana commented on SUREFIRE-1985:
----------------------------------------

We have integration tests which prove that all tests must pass with 
<forkCount>1</forkCount> & <rerunFailingTestsCount>3</rerunFailingTestsCount>.
Regarding the question of isolating the test methods in separate JVMs, you have 
to have only one test method in a test class. The reason is that the plugins 
fork test classes. Methods are not forked. Only classes are forked.

> While running test cases if a test case fails, need to kill the fork and run 
> subsequent testcases(including the failed one) with a new fork  
> ---------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SUREFIRE-1985
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1985
>             Project: Maven Surefire
>          Issue Type: Wish
>          Components: process forking
>            Reporter: Sanidhya Vijaivargia
>            Priority: Major
>         Attachments: Screenshot 2022-01-25 at 10.36.34 AM.png
>
>
> After running a particular module/project if the test fails even after 
> rerunning it N specified times the subsequent modules fail automatically 
> without running them.
> Following is a use-case for this
> {code:java}
> import org.junit.Assert;
> import org.junit.Test;
> public class surefireTest {
>     private static boolean flag = true;
>     @Test
>     public void test1() {
>         Assert.assertTrue(flag);
>         flag = false;
>     }
>     @Test
>     public void test2() {
>         test1();
>     }
>     @Test
>     public void test3() {
>         test1();
>     }
> }
>  {code}
> Running the above code using surefire using <forkCount>1</forkCount> & 
> <rerunFailingTestsCount>3</rerunFailingTestsCount> should ideally be able to 
> pass all the testcases, but in our case it is able to pass just testcase 1. 
> Is it possible to have a completely isolated environment (free from pollution 
> from other testcases) for all 3 testcases, that is as soon as a testcase 
> fails, we kill the current fork and start a new fork and retry for the failed 
> testcase and so on.
> Please find the observed result attached below.
> Thanks!



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to