通过方案名称在另一个功能文件中调用方案 [英] Calling a scenario in another feature file by scenario name
本文介绍了通过方案名称在另一个功能文件中调用方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下功能文件:
checkout.feature
checkout.feature
Scenario: checkout items in basket
* call read('classpath:login.feature@[call by scenario name]')
Given path '/checkout'
And request {"items":{"biscuits": 1,"apples": 2}}
When method post
Then status 200
在检查购物篮中的项目之前,我想按方案名称(使用凭据登录到应用程序)调用login.feature,而无需使用标签.能否请您告诉我这样做的语法?
Before checking out the items in the basket, I would like to call the login.feature by scenario name (log into app with credentials), without the use of a tag. Could you please tell me the syntax in order to do so?
login.feature
login.feature
Scenario: log into app with credentials
Given path '/login'
And request {"userDetails":{"userName": 1,"apples": 2}}
When method post
Then status 200
我已阅读 https://github.com/intuit/karate#call-标签选择器,但似乎无法使其正常工作.
I have read https://github.com/intuit/karate#call-tag-selector but can't seem to get it to work.
推荐答案
因为您没有标签.将此行添加到login.feature
中的Scenario
上方:
Because you don't have a tag. Add this line above the Scenario
in login.feature
:
@foo
然后您只需执行以下操作:
And then you just do this:
* call read('classpath:login.feature@foo')
这篇关于通过方案名称在另一个功能文件中调用方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文