Class AdvancedRunner

  • All Implemented Interfaces:
    org.junit.runner.Describable, org.junit.runner.manipulation.Filterable, org.junit.runner.manipulation.Orderable, org.junit.runner.manipulation.Sortable

    public class AdvancedRunner
    extends org.junit.runners.BlockJUnit4ClassRunner
    Tiered Junit 4 Test Runner.

    Supports @Slow and @Stress supplemental annotation on test methods to allow for filtering of what class of test to execute.

        @Test
        @Slow
        public void testLotsOfStuff() {
           ... do something long and complicated ...
        }
        
        @Test
        @Stress("requirements to satisfy this test")
        public void testUsingLotsOfResources() {
           ... do something that uses lots of resources ...
        }
        
        @Test
        public void testSimple() {
           ... do something that happens quickly ...
        }
     
    To enable / disable the various tests, you have some System properties you can utilize.
    -Dtest.fast
    If present, this will disable @Slow
    -Dtest.slow=(boolean)
    Enable or disable the @Slow tests.
    Default: true
    -Dtest.stress=(boolean)
    Enable or disable the @Stress tests.
    Default: false
    • Constructor Summary

      Constructors 
      Constructor Description
      AdvancedRunner​(java.lang.Class<?> klass)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private boolean isEnabled​(java.lang.String key, boolean def)  
      private void notify​(java.lang.String msg, org.junit.runner.Description description)  
      protected void runChild​(org.junit.runners.model.FrameworkMethod method, org.junit.runner.notification.RunNotifier notifier)  
      • Methods inherited from class org.junit.runners.BlockJUnit4ClassRunner

        collectInitializationErrors, computeTestMethods, createTest, createTest, describeChild, getChildren, getTestRules, isIgnored, methodBlock, methodInvoker, possiblyExpectingExceptions, rules, testName, validateConstructor, validateFields, validateInstanceMethods, validateNoNonStaticInnerClass, validateOnlyOneConstructor, validateTestMethods, validateZeroArgConstructor, withAfters, withBefores, withPotentialTimeout
      • Methods inherited from class org.junit.runners.ParentRunner

        childrenInvoker, classBlock, classRules, createTestClass, filter, getDescription, getName, getRunnerAnnotations, getTestClass, order, run, runLeaf, setScheduler, sort, validatePublicVoidNoArgMethods, withAfterClasses, withBeforeClasses, withInterruptIsolation
      • Methods inherited from class org.junit.runner.Runner

        testCount
      • Methods inherited from class java.lang.Object

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

      • slowTestsEnabled

        private boolean slowTestsEnabled
      • stressTestsEnabled

        private boolean stressTestsEnabled
    • Constructor Detail

      • AdvancedRunner

        public AdvancedRunner​(java.lang.Class<?> klass)
                       throws org.junit.runners.model.InitializationError
        Throws:
        org.junit.runners.model.InitializationError
    • Method Detail

      • isEnabled

        private boolean isEnabled​(java.lang.String key,
                                  boolean def)
      • runChild

        protected void runChild​(org.junit.runners.model.FrameworkMethod method,
                                org.junit.runner.notification.RunNotifier notifier)
        Overrides:
        runChild in class org.junit.runners.BlockJUnit4ClassRunner
      • notify

        private void notify​(java.lang.String msg,
                            org.junit.runner.Description description)