Class RemoteLogDumperRule

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

    public class RemoteLogDumperRule
    extends org.junit.rules.TestWatcher
    The RemoteLogDumper Rule fetches logs which are generated due to execution of test from the remote server and dumps them locally upon test failure. This simplifies determining failure cause by providing all required data locally. This would be specially useful when running test in CI server where server logs gets cluttered with all other test executions Can be constructed either with a SlingClient or with a Instance
         public class LoginTestIT {
    
         @Rule
         public TestRule logDumper = new RemoteLogDumperRule(slingClient);
         // OR public TestRule logDumper = new RemoteLogDumperRule(myInstance);
    
         @Test
         public void remoteLogin() {
              //Make calls to remote server
              assertEquals("testA", name.getMethodName());
         }
    
         }
     
    • Constructor Detail

      • RemoteLogDumperRule

        public RemoteLogDumperRule()
      • RemoteLogDumperRule

        public RemoteLogDumperRule​(Instance instance)
      • RemoteLogDumperRule

        public RemoteLogDumperRule​(org.apache.sling.testing.clients.SlingClient slingClient)
    • Method Detail

      • setSlingClient

        public RemoteLogDumperRule setSlingClient​(org.apache.sling.testing.clients.SlingClient slingClient)
      • apply

        public org.junit.runners.model.Statement apply​(org.junit.runners.model.Statement base,
                                                       org.junit.runner.Description description)
        Specified by:
        apply in interface org.junit.rules.TestRule
        Overrides:
        apply in class org.junit.rules.TestWatcher
      • finished

        protected void finished​(org.junit.runner.Description description)
        Overrides:
        finished in class org.junit.rules.TestWatcher
      • starting

        protected void starting​(org.junit.runner.Description description)
        Overrides:
        starting in class org.junit.rules.TestWatcher
      • failed

        protected void failed​(Throwable e,
                              org.junit.runner.Description description)
        Overrides:
        failed in class org.junit.rules.TestWatcher