Feature: Dynamic Scenario Outline
Background:
* def kittens = [{"name":"abc"},{"name":"def"}]
Scenario Outline: cat name: <name>
* print <name>
Examples:
| kittens |
执行这段代码后的错误是:
org.graalvm.polyglot.PolyglotException: ReferenceError: "kittens" is not defined
然而,如果我将这个 JSON 直接放入示例中,则会工作并执行 2 次。通过如下图:
Examples:
| [{"name":"abc"},{"name":"def"}] |
为什么我得到“小猫”未定义,知道吗?
The Background
在新版本的空手道中不会这样工作。
请阅读:https://github.com/karatelabs/karate/releases/tag/v1.3.0
So try:
Feature:
@setup
Scenario:
* def kittens = [{"name":"abc"},{"name":"def"}]
Scenario Outline: cat name: <name>
* print name
Examples:
| karate.setup().kittens |
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)