[ 
https://issues.apache.org/jira/browse/OPENJPA-766?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12646598#action_12646598
 ] 

Pinaki Poddar commented on OPENJPA-766:
---------------------------------------

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


> Tests that currently fail should be committed to the repository
> ---------------------------------------------------------------
>
>                 Key: OPENJPA-766
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-766
>             Project: OpenJPA
>          Issue Type: Test
>            Reporter: Pinaki Poddar
>
> 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.  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to