我们如何在空手道特征文件的后台函数中传递多个参数

时间:2019-06-26 14:12:11

标签: karate

我将两个参数传递给我的自定义函数,但在后台传递参数时,它首先跳过,仅次于第二个。 这是示例代码

* 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

1 个答案:

答案 0 :(得分:1)

当您要传递两个参数时,需要将其作为两个json键/值发送。

* def result = call LoadToTigerGraph { var1: "functionnal", var2: "/EndTestSample.json" }

您只需要在函数args.var1中使用args.var2function(args)

相关问题