You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Bertrand Delacretaz (JIRA)" <ji...@apache.org> on 2015/01/09 17:58:34 UTC

[jira] [Commented] (SLING-4280) Enable dumping of remote server logs in case of test failures

    [ https://issues.apache.org/jira/browse/SLING-4280?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14271530#comment-14271530 ] 

Bertrand Delacretaz commented on SLING-4280:
--------------------------------------------

This looks good to me but I haven't been able to get it to work on a different example.

After applying your patch, rebuilding what's needed and applying the patch below, I run the EventsCounterTest against a Sling instance where the org.apache.sling.launchpad.test-services bundle is disabled, which correctly causes the test to fail.

The test output at target/surefire-reports/org.apache.sling.launchpad.webapp.integrationtest.EventsCounterTest.txt, however, doesn't contain any server logs. I guess the root cause is that none of the RemoteLogDumper methods get called (checked with a debugger on the client side) - can you spot what I'm doing wrong?

/system/sling/testlog does show the expected EventsCounterTest logs.

{code}
Index: src/main/java/org/apache/sling/launchpad/webapp/integrationtest/EventsCounterTest.java
===================================================================
--- src/main/java/org/apache/sling/launchpad/webapp/integrationtest/EventsCounterTest.java	(revision 1650582)
+++ src/main/java/org/apache/sling/launchpad/webapp/integrationtest/EventsCounterTest.java	(working copy)
@@ -22,10 +22,12 @@
 import org.apache.sling.commons.testing.junit.Retry;
 import org.apache.sling.commons.testing.junit.RetryRule;
 import org.apache.sling.launchpad.webapp.integrationtest.util.EventsCounterUtil;
+import org.apache.sling.testing.tools.junit.RemoteLogDumper;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.TestRule;
 
 /** Test the EventsCounter servlet and underlying events subsystems */
 public class EventsCounterTest {
@@ -37,6 +39,9 @@
     @Rule
     public RetryRule retryRule = new RetryRule();
     
+    @Rule
+    public TestRule logRule = new RemoteLogDumper();
+    
     /** HTTP tests helper */
     private static final HttpTest H = new HttpTest();
{code}

> Enable dumping of remote server logs in case of test failures
> -------------------------------------------------------------
>
>                 Key: SLING-4280
>                 URL: https://issues.apache.org/jira/browse/SLING-4280
>             Project: Sling
>          Issue Type: New Feature
>          Components: Testing
>            Reporter: Chetan Mehrotra
>            Assignee: Chetan Mehrotra
>         Attachments: SLING-4280.patch, test-fail-output.txt
>
>
> In case of large test suite running on CI server its hard to make out which logs were created due to execution of which testcase. This makes determining the cause of testcase failure difficult. Often the server logs are also not avialable once the build is completed and only source of information is system out logs captured via junit framework on client side.
> This debugging process can be made simpler if the testcase also dumps the server side logs generated while that testcase executes locally upon failure



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)