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

        There are no Sub-Tasks for this issue.

          Activity

          Donald Woods made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Darren Woods committed 921035 (2 files)
          Donald Woods made changes -
          Fix Version/s 2.0.0-M1 [ 12313624 ]
          Affects Version/s 2.0.0-M1 [ 12313624 ]
          Donald Woods made changes -
          Link This issue relates to OPENJPA-998 [ OPENJPA-998 ]
          Pinaki Poddar made changes -
          Link This issue is related to OPENJPA-949 [ OPENJPA-949 ]
          Pinaki Poddar made changes -
          Link This issue is related to OPENJPA-773 [ OPENJPA-773 ]
          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.
          Pinaki Poddar made changes -
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Resolved [ 5 ]
          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.
          Pinaki Poddar made changes -
          Field Original Value New Value
          Assignee Pinaki Poddar [ ppoddar@apache.org ]
          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(); } }
          ppoddar committed 713084 (2 files)
          Reviews: none

          OPENJPA-766: Allow Tests that fail to be included in the repository. Annotate the TestCase or its specific methods with @AllowFailure(true|false)

          Pinaki Poddar created issue -

            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