Karate 如何在空手道功能文件的后台函数中传递多个参数
我正在将这两个参数传递给我的自定义函数,但在后台,当我传递参数时,它会跳过第一个参数,只传递第二个参数。 下面是示例代码Karate 如何在空手道功能文件的后台函数中传递多个参数,karate,Karate,我正在将这两个参数传递给我的自定义函数,但在后台,当我传递参数时,它会跳过第一个参数,只传递第二个参数。 下面是示例代码 * def LoadToTigerGraph = """ function(args1,args2) { var CustomFunctions = Java.type('com.optum.graphplatform.util.CareGiverTest'); var cf = new CustomFunctions();
* def LoadToTigerGraph =
"""
function(args1,args2) {
var CustomFunctions = Java.type('com.optum.graphplatform.util.CareGiverTest');
var cf = new CustomFunctions();
return cf.testSuiteTrigger(args1,args2);
}"""
#*eval if (karate.testType == "component") karate.call(LoadToTigerGraph '/EndTestSample.json')
* def result = call LoadToTigerGraph "functional","/EndTestSample.json"
输出:
test type is ************/EndTestSample.json
path is *************undefined
当您想要传递两个参数时,需要将它们作为两个json键/值发送
* def result = call LoadToTigerGraph { var1: "functionnal", var2: "/EndTestSample.json" }
您只需在函数functorgs中使用args.var1和args.var2,实际上对于JS,您可以这样做:*def result=LoadToTigerGraphfunctional,/EndTestSample.json