尝试从config.params传递git凭据,以便在使用所有功能文件(测试)之前从git下载一次测试数据。
我使用了repo.feature的karate.callSingle()函数exeute和参数。
下面是karate-config.js文件。
var config={
URL : "http://api.com",
params : {"password":pws, "username":user }
}
if( Catg == "_model"){
var getGit = karate.callSingle('classpath:com/repo.feature', config.params);
var gitrepo= getGit
}在repo.feature中尝试获取参数的值。尝试了很多方法,但都不会出错。
* print '#{config.params}'
// it returns -- #{config.params}
* def code1 = __arg.params
* print code1
// it returns -- null
* print params
// it returns error -- params is define
* print config.params
// it returns error -- config is define 尝试打印karate-config.js文件中的值,然后返回object Object
karate.log("******"+ config.params+" ----------") 发布于 2021-09-10 18:51:38
如果* print params不能工作,那么您一定遗漏了一些基本的东西。请按照以下流程操作:https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue
https://stackoverflow.com/questions/69136022
复制相似问题