空手道 - 如何从单个主要功能调用多个外部功能 [英] Karate - How to call multiple external features from a single main feature
本文介绍了空手道 - 如何从单个主要功能调用多个外部功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Feature: Principal feature
Background:
* url 'http://example.com'
Scenario: Feature calling
* def inputTable = call read('input_table.feature')
* call read('my_call.feature') inputTable.inputTestData
数据表文件在哪里:
//input_table.feature
Feature:TABLE_TEST
Scenario:TABLE_TEST
* table inputTestData
|inputName|outputName|
|requestA|responseA|
这给我一个错误:
ERROR com.intuit.karate - feature call failed: .../input_table.feature
arg: null
input_table.feature:3 - evaluation (js) failed: requestA, javax.script.ScriptException: ReferenceError: "requestA" is not defined in <eval> at line number 1
stack trace: jdk.nashorn.api.scripting.NashornScriptEngine.throwAsScriptException(NashornScriptEngine.java:470)
但是,如果我使用 Examples
字段中定义的数据表调用 my_call 功能,它可以正常工作.
but instead if i call the my_call feature with the data table defined inside in the Examples
field it works correctly.
有什么帮助吗?
推荐答案
Examples
和 table
之间存在细微差别.也许你打算这样做:
There's a subtle difference between Examples
and table
. Maybe you meant to do this:
* table inputTestData
|inputName|outputName|
|'requestA'|'responseA'|
阅读文档:https://github.com/intuit/karate#table
这篇关于空手道 - 如何从单个主要功能调用多个外部功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文