我们如何在空手道功能文件中的背景函数中传递多个参数



我将两个参数传递给我的自定义函数,但是在我传递参数时,它是跳过第一个唯一的庇护。这是示例代码

* 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" }

您只需要在功能中使用args.var1args.var2 function(args)

最新更新