我有 2 个功能文件并尝试执行以下操作
特征 1:[calling.feature]
Feature: Test loop over by calling a feature file
Scenario Outline: Testing loop over feature file
* call read('called.feature') { argument = '<arg>' }
Examples:
|arg|
|"HELLO"|
|"WORLD"|
Run Code Online (Sandbox Code Playgroud)
特征 2:[被称为.特征]
Feature: Test loop over in Karate framework
Scenario Outline: Testing loop over feature
* def callingArg = arg
* match '<arg2>' == callingArg
Examples:
|arg2|
|"TEST1"|
|"WORLD"|
Run Code Online (Sandbox Code Playgroud)
当我使用 'Calling.feature' 中的 read 调用 'Called.feature' 时,我期望它会在两个功能文件中的所有示例中迭代使用
但是空手道在发现失败时退出,在这种情况下,当从 Calling.feature 传递参数“HELLO”时,它在“被调用的.特征”中的匹配步骤期间失败,例如“TEST1”,并且从不测试“WORLD”。
有没有办法可以强制空手道完成被调用的功能中的所有场景示例???
以下是日志:
calling: [com.intuit.karate.exception.KarateException: path: $, actual: 'HELLO', expected: 'TEST1', reason: not equal
at com.intuit.karate.StepDefs.matchNamed(StepDefs.java:540)
at com.intuit.karate.StepDefs.matchEquals(StepDefs.java:526)
at ?.* match fileName == "TEST1"(called.feature:16)
, com.intuit.karate.exception.KarateException: path: $, actual: 'WORLD', expected: 'TEST1', reason: not equal
at com.intuit.karate.StepDefs.matchNamed(StepDefs.java:540)
at com.intuit.karate.StepDefs.matchEquals(StepDefs.java:526)
at ?.* match fileName == "TEST1"(called.feature:16)
, com.intuit.karate.exception.KarateException: feature call (loop) failed: called.feature
caller: calling.feature
items: [{mdbName=HELLO}, {mdbName=WORLD}]
errors:
-------
feature call (loop) failed at index: 0
caller: calling.feature
arg: {mdbName=HELLO}
path: $, actual: 'HELLO', expected: 'TEST1', reason: not equal
-------
feature call (loop) failed at index: 1
caller: calling.feature
arg: {mdbName=WORLD}
path: $, actual: 'WORLD', expected: 'TEST1', reason: not equal
at com.intuit.karate.Script.evalFeatureCall(Script.java:1636)
at com.intuit.karate.Script.call(Script.java:1579)
at com.intuit.karate.Script.callAndUpdateConfigAndAlsoVarsIfMapReturned(Script.java:1669)
at com.intuit.karate.StepDefs.callAndUpdateConfigAndVars(StepDefs.java:571)
at ?.* call read('called.feature') mdbData(calling.feature:9)
Run Code Online (Sandbox Code Playgroud)
你的格式很难理解。无论如何,即使出现失败,空手道也应该评估所有示例行。这是一个简单的例子:
Feature:
Scenario Outline:
* call read('called.feature') { a: <value> }
Examples:
| value |
| 1 |
| 2 |
| 3 |
Run Code Online (Sandbox Code Playgroud)
并且called.feature是:
Feature:
Scenario:
* match a == 2
Run Code Online (Sandbox Code Playgroud)
它按预期工作。即使第 1 行和第 3 行失败,也会执行所有行。因此,您可能使用的是旧版本的空手道。请升级。
编辑:这是在 0.8.0 中修复的:https : //github.com/intuit/karate/issues/421
| 归档时间: |
|
| 查看次数: |
1447 次 |
| 最近记录: |