Class RemoteLogDumperRule
- java.lang.Object
-
- org.junit.rules.TestWatcher
-
- org.apache.sling.testing.junit.rules.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 aSlingClient
or with aInstance
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 Summary
Constructors Constructor Description RemoteLogDumperRule()
RemoteLogDumperRule(org.apache.sling.testing.clients.SlingClient slingClient)
RemoteLogDumperRule(Instance instance)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.junit.runners.model.Statement
apply(org.junit.runners.model.Statement base, org.junit.runner.Description description)
protected void
failed(Throwable e, org.junit.runner.Description description)
protected void
finished(org.junit.runner.Description description)
RemoteLogDumperRule
setInstance(Instance instance)
RemoteLogDumperRule
setSlingClient(org.apache.sling.testing.clients.SlingClient slingClient)
protected void
starting(org.junit.runner.Description description)
-
-
-
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)
-
setInstance
public RemoteLogDumperRule setInstance(Instance instance)
-
apply
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description)
- Specified by:
apply
in interfaceorg.junit.rules.TestRule
- Overrides:
apply
in classorg.junit.rules.TestWatcher
-
finished
protected void finished(org.junit.runner.Description description)
- Overrides:
finished
in classorg.junit.rules.TestWatcher
-
starting
protected void starting(org.junit.runner.Description description)
- Overrides:
starting
in classorg.junit.rules.TestWatcher
-
failed
protected void failed(Throwable e, org.junit.runner.Description description)
- Overrides:
failed
in classorg.junit.rules.TestWatcher
-
-