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

Surefire reports wrong number of failed tests when using JUnit's ErrorCollector rule

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 2.10
    • None
    • Maven Surefire Plugin
    • None

    Description

      When running a test that contains an ErrorCollector, test failures are not correct when an errorcollector contains failures. For example:

      public class ExampleTest {
          @Rule
          public ErrorCollector errorCollector = new ErrorCollector();
      
          @Test
          public void testWithErrorCollector() {
              errorCollector.checkThat(true, is(false));
              errorCollector.checkThat(3, is(4));
          }
      }
      

      Surefire will reports 2 tests run (of which all failed). However, when you fix the same test so that no checks fail, Surefire will report 1 test run.

      This is incorrect, as this will result in false information in systems like Hudson or Sonar, the number of testcase should not fluctuate. Surefire should only report 1 test run, as that reflects the actual situation.

      Attachments

        Issue Links

          Activity

            People

              tibordigana Tibor Digana
              doclolieven Lieven Doclo
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: