Class RepeatRule

  • All Implemented Interfaces:
    org.junit.rules.TestRule

    public class RepeatRule
    extends java.lang.Object
    implements org.junit.rules.TestRule
    TestRule which enables to run the same JUnit test repeatedly. Add this rule to the test class
     public class MyTest {
            @Rule
            public RepeatRule repeatRule = new RepeatRule();
            ...
     }
     
    and annotate the test to be repeated with the @Repeat(n=<repetitions>) annotation
     @Test
     @Repeat(n = 100)
     public void test() {
            ...
     }
     
    then this test will be repeated 100 times. If any test execution fails test repetition will be stopped.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.util.logging.Logger LOG  
    • Constructor Summary

      Constructors 
      Constructor Description
      RepeatRule()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.junit.runners.model.Statement apply​(org.junit.runners.model.Statement statement, org.junit.runner.Description description)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • LOG

        private static final java.util.logging.Logger LOG
    • Constructor Detail

      • RepeatRule

        public RepeatRule()
    • Method Detail

      • apply

        public org.junit.runners.model.Statement apply​(org.junit.runners.model.Statement statement,
                                                       org.junit.runner.Description description)
        Specified by:
        apply in interface org.junit.rules.TestRule