从通过示例部分传递的 yml 文件驱动的数据在空手道中不起作用

data driven from yml file passed through the example section is not working in karate

工作场景: 特征:测试特征

场景大纲:测试场景

Given url 'some url'
Given def nameList = read('names.yml')

And print <name>
Examples:
  | name                |
  | nameList.firstName  |
  | nameList.lastName   |
  | nameList.middleName |

每个运行名字打印正确

不工作场景: 特征:测试特征

场景大纲:测试场景

Given url 'some url'
Given def nameList = read('names.yml')
And path 'api/<name>'
When method get
And print <name>

Examples:
  | name                |
  | nameList.firstName  |
  | nameList.lastName   |
  | nameList.middleName |

而不是值,它发送为 api/nameList.firstName,api/nameList.lastName,nameList.middleName

只需进行以下更改:

And path 'api', <name>