问题
Hi I have the following feature file:
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
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
Scenario: log into app with credentials
Given path '/login'
And request {"userDetails":{"userName": 1,"apples": 2}}
When method post
Then status 200
I have read https://github.com/intuit/karate#call-tag-selector but can't seem to get it to work.
回答1:
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')
来源:https://stackoverflow.com/questions/59970840/calling-a-scenario-in-another-feature-file-by-scenario-name