Feature: Dynamic Scenario Outline
Background:
* def kittens = [{"name":"abc"},{"name":"def"}]
Scenario Outline: cat name: <name>
* print <name>
Examples:
| kittens |
error after executing this code is:
org.graalvm.polyglot.PolyglotException: ReferenceError: "kittens" is not defined
Whereas, if I put this JSON directly into examples, this is working and executing 2 time. passing as shown below:
Examples:
| [{"name":"abc"},{"name":"def"}] |
why am i getting "kittens" is not defined, any idea?
The Background
does not work like this in new versions of Karate.
Please read: 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 |