Fork me on GitHub
#kaocha
<
2020-03-20
>
robert-stuttaford05:03:52

so we have a bunch of tests which use logging. is there a resource i can read on dealing with log output during kaocha runs? we're using the documentation reporter

plexus08:03:23

hi @robert-stuttaford, welcome to #kaocha! 🙂 what exactly are you looking for? I've set up a logging-related kaocha plugin for a client before, not sure if it's generalizable but I can see if I can share that or give you some pointers

robert-stuttaford09:03:40

👋 😃 so we do logging via logback, and our code and tests are peppered with logging calls. I see that K handily rolls up logs collected when a test fails, for the fail report at the end. but it's also blatting them into the 'success tree' at the top, which i'd like to prevent, if possible. perhaps if i took a look at what you have, i'll get enough guidance to sort it out 🙂 thank you, sir!

robert-stuttaford09:03:42

kaocha is a great piece of kit 👏

plexus15:03:18

right, so kaocha by default captures output and only prints the output when a test fails. Since you are seeing them collected together in the failed test report I'm guessing you have output capturing enabled (i.e. you didn't explicitly disable it). then the question is, why are you still seeing it during the test run...

plexus15:03:39

the way we do this is by installing our own (System/setOut new-stream) (System/setErr new-stream) and then restoring them afterwards, but if something holds a reference to the actual process stdout stream they can still print to that of course. Is it possible your logging is outputting to multiple places?

plexus15:03:19

it surprises me that you are seeing the same logging output during the test run and in the failed test summary, normally it's either/or @robert-stuttaford

robert-stuttaford16:03:42

ok that definitely gives me enough to dig around, thanks @plexus 🙂