OpenJPA
  1. OpenJPA
  2. OPENJPA-766

Tests that currently fail should be committed to the repository

    Details

    • Type: Test Test
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0-M1
    • Fix Version/s: 2.0.0-M1
    • Component/s: None
    • Labels:
      None

      Description

      Current surefire test harness fails if any of the tests fails. Surefire allows tests to be ignored but the problem with that approach is the tests to be ignored are mentioned separately via build script .
      A mechanics can be provided for OpenJPA tests that annotates a TestCase or specific methods such that failures of these tests are ignored.

      This facility will help people to contribute tests in the repository that demonstrates a bug or Test Driven Development.

        Issue Links

          Activity

          Hide
          Pinaki Poddar added a comment -

          The tests can now be annotated with following rule:
          1. Test Case can be annotated at class or method level with @AllowFailure(true|false)
          2. Method level annotation has higher precedence than the class level annotation.
          3. The failures in the test method are ignored not the error.

          See the example below:

          package org.apache.openjpa.persistence.test;

          @AllowFailure
          public class TestAllowFailure extends SingleEMFTestCase {

          // No annotation. If the test fails then it will be ignored due to the class level annotation.
          public void testSomething()

          {...}

          // Failure of ths test will be ignored.
          @AllowFailure
          public void testFailedButIgnored()

          { fail(); }

          // Failure of this test will be ignored. But not the error.
          @AllowFailure
          public void testError() { int[] i = new int[2]; i[5] = 5; }

          // Failure of this test will not be ignored
          @AllowFailure(false)
          public void testNotAllowFailure() { fail(); }

          }

          Show
          Pinaki Poddar added a comment - The tests can now be annotated with following rule: 1. Test Case can be annotated at class or method level with @AllowFailure(true|false) 2. Method level annotation has higher precedence than the class level annotation. 3. The failures in the test method are ignored not the error. See the example below: package org.apache.openjpa.persistence.test; @AllowFailure public class TestAllowFailure extends SingleEMFTestCase { // No annotation. If the test fails then it will be ignored due to the class level annotation. public void testSomething() {...} // Failure of ths test will be ignored. @AllowFailure public void testFailedButIgnored() { fail(); } // Failure of this test will be ignored. But not the error. @AllowFailure public void testError() { int[] i = new int[2]; i[5] = 5; } // Failure of this test will not be ignored @AllowFailure(false) public void testNotAllowFailure() { fail(); } }
          Hide
          Pinaki Poddar added a comment -

          The current commit fulfills the basic purpose. Further enhancement can be done in terms of reporting the failed but ignored tests.

          Show
          Pinaki Poddar added a comment - The current commit fulfills the basic purpose. Further enhancement can be done in terms of reporting the failed but ignored tests.
          Hide
          Milosz Tylenda added a comment -

          The website has a good page on how to write tests - HowToWriteTestCaseForOpenJPA. However, the link to it is somewhat hidden in the Get Involved page. I think the project could benefit a bit from adding a link to HowToWriteTestCaseForOpenJPA to the Unit Tests page - these are similar topics and the Unit Tests page is easier to access currently.

          Also, on http://openjpa.apache.org/development.html both Source Code and SourceAccess links point to the same page.

          Show
          Milosz Tylenda added a comment - The website has a good page on how to write tests - HowToWriteTestCaseForOpenJPA. However, the link to it is somewhat hidden in the Get Involved page. I think the project could benefit a bit from adding a link to HowToWriteTestCaseForOpenJPA to the Unit Tests page - these are similar topics and the Unit Tests page is easier to access currently. Also, on http://openjpa.apache.org/development.html both Source Code and SourceAccess links point to the same page.

            People

            • Assignee:
              Pinaki Poddar
              Reporter:
              Pinaki Poddar
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 3h
                3h
                Remaining:
                Remaining Estimate - 3h
                3h
                Logged:
                Time Spent - Not Specified
                Not Specified

                  Development