[ https://issues.apache.org/jira/browse/SLING-3000?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Chetan Mehrotra updated SLING-3000: ----------------------------------- Attachment: SLING-3000.patch This patch adds two classes - TestDescriptionRule - JUnit rule to export current test description as a thread local - TestDescriptionInterceptor - HttpClient interceptor which adds the testName extracted from TestDescriptionRule thread local to the out going request HTTP Header - TestNameLoggingFilter - It logs the testName in server logs and also exposes them in MDC Usage ------ On the client side the test case (or its base class) should have following variable declaration {code} import org.apache.sling.testing.tools.junit.TestDescriptionRule; @Rule public TestDescriptionRule descRule = new TestDescriptionRule(); {code} Then wherever the testcase creates the HttpClient instance it needs to add the interceptor {code} import org.apache.sling.testing.tools.junit.TestDescriptionInterceptor; this.httpClient = new DefaultHttpClient(); this.httpClient.addRequestInterceptor(new TestDescriptionInterceptor()); {code} On server side we can configure the TestNameLoggingFilter which logs the testName to the logs > Support propagation of executing testName to server > --------------------------------------------------- > > Key: SLING-3000 > URL: https://issues.apache.org/jira/browse/SLING-3000 > Project: Sling > Issue Type: Improvement > Components: Testing > Affects Versions: org.apache.sling.testing.tools 1.0.6 > Reporter: Chetan Mehrotra > Priority: Minor > Attachments: SLING-3000.patch > > > 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. If we have some way to > propagate the testName to server then the testname can be exposed as part of > MDC [1] and made part of logged statement > Currently Sling Logging does not support MDC but at minimum we can have a > filter which can log the test name extracted from HTTP Header allowing a user > to correlate the logs with testcase failures > [1] http://www.slf4j.org/manual.html#mdc -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira