本文介绍了空手道api测试-我想掩盖参数值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想屏蔽空手道日志中的Maven输入参数值

I would like to mask maven input param values in karate logs

步骤

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

When param user = karate.properties['UserName']

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

When param password = karate.properties['password']

Maven命令

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

mvn clean test ......... -DUserName=user1 -Dpassword=123456

日志

当我们调用method get方法时,它会打印总的url,因此它也会打印用户名和密码,但我想屏蔽这些值.

When we called method get it prints total url so it's printing user and password as well but I would like to mask those values.

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

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

Expected output log - GET http://......&user=user1&password=XXXXX

推荐答案

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

Please read this issue for multiple solutions: https://github.com/intuit/karate/issues/699#issuecomment-506078717

logback.xml 中的

in 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

Also note that you can omit steps from the log: https://github.com/intuit/karate#report-verbosity

这篇关于空手道api测试-我想掩盖参数值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 19:21