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

Chetan Mehrotra commented on SLING-4280:
----------------------------------------

bq.  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?

Yes for above case the rule is not being invoked as the failure is happening in 
the {{setupClass}} itself. The {{TestRule}} is invoked only for actual test 
method invocation. Here as the failure happens in the {{BeforeClass}} annotated 
method itself the framework does not invoke any test method. JUnit provides a 
[ClassRule|http://junit.org/javadoc/latest/org/junit/ClassRule.html] which can 
be possibly hooked into to get a callback. This can be added as an enhancement 
to current patch

{noformat}
junit.framework.AssertionFailedError: Expected status 200 for 
http://localhost:4513/testing/EventsCounter.json (content=<!DOCTYPE HTML PUBLIC 
"-//IETF//DTD HTML 2.0//EN">
<html>
<head>
<title>404 No resource found</title>
</head>
<body>
<h1>No resource found (404)</h1>
<p>The requested URL /testing/EventsCounter.json resulted in an error in 
org.apache.sling.servlets.resolver.internal.defaults.DefaultErrorHandlerServlet.</p>
<h3>Request Progress:</h3>
<pre>
      0 TIMER_START{Request Processing}
      0 COMMENT timer_end format is {&lt;elapsed msec&gt;,&lt;timer name&gt;} 
&lt;optional message&gt;
      0 LOG Method=GET, PathInfo=/testing/EventsCounter.json
      0 TIMER_START{ResourceResolution}
      1 TIMER_END{1,ResourceResolution} URI=/testing/EventsCounter.json 
resolves to Resource=NonExistingResource, path=/testing/EventsCounter.json
      1 LOG Resource Path Info: SlingRequestPathInfo: 
path=&apos;/testing/EventsCounter.json&apos;, selectorString=&apos;null&apos;, 
extension=&apos;json&apos;, suffix=&apos;null&apos;
      1 TIMER_START{ServletResolution}
      1 TIMER_START{resolveServlet(NonExistingResource, 
path=/testing/EventsCounter.json)}
      3 TIMER_END{2,resolveServlet(NonExistingResource, 
path=/testing/EventsCounter.json)} Using servlet 
org.apache.sling.servlets.get.DefaultGetServlet
      3 TIMER_END{2,ServletResolution} URI=/testing/EventsCounter.json handled 
by Servlet=org.apache.sling.servlets.get.DefaultGetServlet
      3 LOG Applying Requestfilters
      3 LOG Calling filter: 
org.apache.sling.engine.impl.debug.RequestProgressTrackerLogFilter
      3 LOG Applying Componentfilters
      3 TIMER_START{org.apache.sling.servlets.get.DefaultGetServlet#0}
      3 TIMER_END{0,org.apache.sling.servlets.get.DefaultGetServlet#0}
      3 TIMER_START{handleError:status=404}
      4 TIMER_END{1,handleError:status=404} Using handler 
org.apache.sling.servlets.resolver.internal.defaults.DefaultErrorHandlerServlet
      5 TIMER_END{5,Request Processing} Dumping SlingRequestProgressTracker 
Entries
</pre>
<hr>
<address>ApacheSling/2.3 (jetty/8.1.14.v20131031, Java HotSpot(TM) 64-Bit 
Server VM 1.7.0_55, Linux 3.13.0-37-generic amd64)</address>
</body>
</html>
) 
Expected :200
Actual   :404
 <Click to see difference>
        at 
org.apache.sling.commons.testing.integration.HttpTestBase.getContent(HttpTestBase.java:434)
        at 
org.apache.sling.commons.testing.integration.HttpTestBase.getContent(HttpTestBase.java:409)
        at 
org.apache.sling.commons.testing.integration.HttpTestBase.getContent(HttpTestBase.java:401)
        at 
org.apache.sling.commons.testing.integration.HttpTestBase.getContent(HttpTestBase.java:396)
        at 
org.apache.sling.launchpad.webapp.integrationtest.util.EventsCounterUtil.getEventsCount(EventsCounterUtil.java:33)
        at 
org.apache.sling.launchpad.webapp.integrationtest.EventsCounterTest.setupClass(EventsCounterTest.java:51)
{noformat}

> 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)

Reply via email to