我想用数据驱动测试条件逻辑中的另一个功能文件(正常的编程语言中有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
答案 0 :(得分:1)
向karate.call
传递值不同于call
,因为karate.call
应该像函数一样被调用
尝试,
* eval if(switchVar1 == 1) karate.call('<FILE_PATH>', testVars)