Karate 条件逻辑中驱动的数据不';I don’我没有按预期工作

Karate 条件逻辑中驱动的数据不';I don’我没有按预期工作,karate,Karate,我想在条件逻辑中测试数据驱动的另一个特性文件(普通编程语言有if-else if-else if-else,但在空手道中可能不支持两个以上的条件) 这是我的演示功能文件: Feature: conditional logic call demo Scenario: * def switchVar1 = 1 * def switchVar2 = 2 * table testVars |switchVar1|switchVar2| |'theOne1

我想在条件逻辑中测试数据驱动的另一个特性文件(普通编程语言有if-else if-else if-else,但在空手道中可能不支持两个以上的条件)

这是我的演示功能文件:

Feature: conditional logic call demo

  Scenario:

    * def switchVar1 = 1
    * def switchVar2 = 2

    * table testVars
    |switchVar1|switchVar2|
    |'theOne1'  | 'theTwo1' |
    |'theOne2'  | 'theTwo2' |


# here I can not do data-driven test the feature file: 'callUsage/module1/demo_module1.feature' 
 * eval if(switchVar1 == 1) 
     karate.call('classpath:callUsage/module1/demo_module1.feature') testVars
错误日志

flow.feature:30 - javascript evaluation failed: if(switchVar1 == 1) karate.call('classpath:callUsage/module1/demo_module1.feature') testVars, <eval>:1:84 Expected ; but found testVars
if(switchVar1 == 1) karate.call('classpath:callUsage/module1/demo_module1.feature') testVars
                                                                                    ^ in <eval> at line number 1 at column number 84
flow.feature:30-javascript评估失败:if(switchVar1==1)karate.call('classpath:callUsage/module1/demo_module1.feature')testVars,:预期为1:84;但是发现了testVars
if(switchVar1==1)karate.call('classpath:callUsage/module1/demo_module1.feature')testVars
^在第1行第84列中

将值传递给
karate.call
call
不同,因为
karate.call
应该像函数一样调用

试试看

*eval if(switchVar1==1)karate.call(“”,testVars)

哇,我明白了。对不起,我误解了“call”的用法。
* eval if(switchVar1 == 1) karate.call('<FILE_PATH>', testVars)