How would I syntactically go about using a table in a separate .feature file for multiple Scenario Outlines in multiple .feature files? I'm working on only updating my test data in one place, with all the benefits that ensues.
I currently have a Scenario Outline
with a simple Examples
table like this:
Given path 'GetIds'
* header Authorization = auth
* request { Id: <Id> }
* method post
* status 200
Examples:
| Id |
| 'a' |
| 'b' |
Looking at the links in the results of Karate - Possible to put scenario in a loop? seems like where I should be looking, but I can't infer what my Examples.feature file should look like.
Edit: The following Cucumber example seems very clear to me (blatantly stolen from Cucumber: Scenario Outline reusing examples table )
Examples:{'datafile':'resources/testdata.txt'}
but is apparently invalid in Karate.
Edit2:
Creating a separate ids.json file and reading it via * def ids = read('ids.json')
works.
Using it like this:
Feature: Dummy
Background:
* def ids = read('ids.json')
Scenario: GetIds
* print ids
* print ids.id
* match each ids contains { id: #string }
The above will pass given the data from the old Examples
table in json format.
But I do not get each id output on * print ids.id
and I don't see the GetIds scenario executed more than once.
I expected it to execute for each object in the json array in ids.json, as described in https://github.com/intuit/karate#data-driven-features