您好,我有以下功能文件:
结账功能
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(使用凭据登录应用程序),而不使用标签。您能告诉我这样做的语法吗?
登录功能
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-tag-selector但似乎无法让它工作。
因为你没有标签。在
Scenario
中的 login.feature
上方添加此行:
@foo
然后你就这样做:
* call read('classpath:login.feature@foo')
特点1 @example标签 场景:名字
功能2