Uploaded image for project: 'Maven Surefire'
  1. Maven Surefire
  2. SUREFIRE-1984

To be able to kill a fork as soon as a test case fails and start a new fork from the failed testcase, following which subsequent testcases are run.

    XMLWordPrintableJSON

Details

    • Wish
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • Backlog
    • process forking
    • None

    Description

      I need this feature because some testcases need isolated environment to run. I have seen that certain testcases fail on an existing fork but seem to run fine on a new fork. I want to be able to keep the number of active forks same at all times. Just that kill the fork that executes a failed testcase and retry on a newly generated fork.

      The idea in a nutshell:


      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();
          }
      }
      

      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!
       

      Attachments

        Activity

          People

            Unassigned Unassigned
            _rishabharora Rishabh Arora
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: