If you use the Karate parallel runner it is designed to collect anything logged to package com.intuit.karate
, which will then appear in the cucumber-html-report.
So you can try using the same slf4j Logger
– and it might work.
A better way might be to just return a Map
back to Karate from your Java code, with all the information you need to log. Then all you need to do is use the print
keyword. I would recommend this approach actually, it should be less complicated and it does not assume that you are using the Cucumber HTML reporting. You could even do Karate asserts with the match
keyword on the JSON that you get, refer to this example: dogs.feature
.