I have
<logger name="com.intuit.karate" level="DEBUG"/>
in my logback-test.xml. But when I run my tests I see that when the step
* assert SchemaUtils.isValid(response, schema)
fails, I do not see any debug information in the Cucumber report (with the payload and description on which field is missing or which value is wrong), like:
error: object instance has properties which are not allowed by the schema: ["PrSKU"]
level: "error"
I do see it in the console though:
{content_type=, value=21:54:25.380 assertion failed: assert evaluated to false: SchemaUtils.isValid(response, schema)21:54:25.413
How can I get logs printed in the report?
I found how to access previous request/response and the print it in the report:
// setup global hook to log details only on failed scenarios
karate.configure('afterScenario', function(){
var info = karate.info;
if(info.errorMessage) {
karate.log('failed',info.scenarioType+':',info.scenarioName);
var r = karate.prevRequest;
if(r) {
var log = 'request: ' + r.method + ' ' + r.uri + '\n' + karate.pretty(r.headers)
if(r.body) log += '\n' + karate.pretty(r.body)
karate.log(log);
karate.log('response: ' + karate.pretty(response));
}
}
})
But I did not find the way how to access karate logs and then print them in the report.