Hi Team,

As part of SLING-4280 its now possible to obtain and dump server side
log which are logged while the given test method is being run. This
should help a developer to determine the failure cause.

However at times we need debug level logs for certain logger
categories to determine the actual cause. Changing the log level at
start would lead to too much noise and might not be desirable. Instead
if a developer can enable logs for specific test case and get those
logs dumped upon failure then that would be helpful. With Logback we
can extend the impl in SLING-4280 to do that.

The only missing piece is how a developer indicate that debug logs
should be enabled for such and such testcase before next CI run is
done. I can think of following approaches

A - Annotation
-------------------

In this the testcase is annotated with desired logger categories and
then RemoteLogDumper TestRule would work with server to get debug logs
enabled for those categories

    @LogCategories({"org.apache.jackrabbit.oak", "org.apache.sling"})
    @Test
    public void testValidatingCorrectFormCredentials() throws Exception {
        List<NameValuePair> params = new ArrayList<NameValuePair>();

So here upon seeing a test failure in CI a developer would

1. Add the required annotation on failing test
2. Checkin the updated file
3. Wait for next run result

One potential downside in CI env where module running the test uses
released version of integration test module this would not work as
updated bundle would not be picked up

B - Config file
------------------

Here we add a config file in the _project where CI test cases are run_
for e.g. launchpad/testing/src/test in case of Sling and
RemoteLogDumper rule would read this file on next run and turn on logs
when given testcase is being executed

So here upon seeing a test failure in CI a developer would

1. Update the required config file in module launching integration test
2. Checkin the updated file
3. Wait for next run result

Thoughts? Would such a support would be useful. If yes then which
approach should be taken

Chetan Mehrotra

Reply via email to