Reputation: 181
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.
Upvotes: 2
Views: 1700
Reputation: 57
Feature1
@exampleTag
Scenario: Name
Feature2
def result = call read('classpath:pathFromSourceRoot/Feature1.feature@exampleTag')
Upvotes: 1
Reputation: 58098
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')
Upvotes: 2