1

I am already using Error log in logback-test.xml I am also using log modifier to hide secret keys in request and response.

Everything in karate report looks good and all data is masked as expected like the header name is "Authorization" which is coming as masked in karate report in this variable "authToken" value is getting passed from karate-config.js. In cucumber report too same header is masked but cucumber report is showing additional information and displaying karate-config.js file contents which has all data. What can I do to hide this information in cucumber report?

I have tried this as well it doesn't display request and response but still prints all contents of karate-config.js in cucumber report.

This only happens for the first feature file when project executes it displays the contents of karate-config.js

//ConfigurereportstonotshowrawHTTPrequests/responses,andtoskipnon-BDD(asterisk)steps
karate.configure('report',{showLog:false,showAllSteps:false})

enter image description here

EDITED

Thanks Peter atleast now I understood the issue. We have to call one feature file from Karate-config.js once only for whole project. To do that we are doing below

 var sample = karate.callSingle('classpath:sample/test.feature@test1',config);

As we are calling this from karate-config.js so in cucumber report it is showing the complete list of variables and then calling this feature file once. This contains very sensitive data which we can't show in report. I tried adding annotation @report=false with scenario in test.feature@test1 it is still showing the variables list. As we are passing arguments as config in callSingle it will show list of variables in report. Please guide on this how to tackle such issue.

Maddy
  • 674
  • 1
  • 7
  • 26

1 Answers1

0

Please read the section on "Log Masking Caveats". If you use a call in any form, parameters will be printed to the log by default.

https://github.com/karatelabs/karate#log-masking-caveats

Note that you can call a feature file, which has the @report=false annotation, and that might be the easy solution.

EDIT: A feature request has been logged: https://github.com/karatelabs/karate/issues/1837

The link above also provides a workaround you can use until the feature is released.

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248
  • 1
    Thanks Peter. I understood the problem. As we are calling another feature file from karate-config.js and passing variables in that as well that's why in Cucumber report it is displaying all karate-config.js variables only for the first feature file. Updating the question to include a sample code and how I can avoid that? – Maddy Nov 15 '21 at 09:43
  • @Maddy the only idea I have is to put the `@report=false` annotation in `test.feature`. else I really don't know. please contribute code or find someone to do it. no one else has requested for this – Peter Thomas Nov 15 '21 at 11:44