空手道api测试-我想掩盖参数值

时间:2019-11-01 21:55:36

标签: karate

我想屏蔽空手道记录中的Maven输入参数值

步骤

当参数用户= karate.properties ['UserName']

当参数密码= karate.properties ['password']

Maven命令

MVN干净测试......... -DUserName = user1 -Dpassword = 123456

日志

当我们调用method get时,它会打印总URL,因此它也要打印用户名和密码,但是我想屏蔽这些值。

Ex-GET http://......&user=user1&password=123456

预期的输出日志-GET http://......&user=user1&password=XXXXX

1 个答案:

答案 0 :(得分:2)

请阅读此问题以获取多种解决方案:https://github.com/intuit/karate/issues/699#issuecomment-506078717

logback.xml中:

<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %replace(%msg){'(?&lt;=api-key:).*', ' xxxx'}%n</pattern>

还要注意,您可以从日志中省略步骤:https://github.com/intuit/karate#report-verbosity