Reputation: 21
I need to replace a value inside the URL
test/lambda-migration/v1/quote'
The v1 needs to be parameterized to take different value, and these values will come from another feature file. My code looks kike this:
Feature file -1
Scenario Outline: Lambda API registration
Given url ApiAdminURL
json myReq = read('swagger-lambda.json')
And request myReq
When method post
Then status
def responsefromsubscriber = call read('Subscriber.feature') { InvokeStatus: '#(InvokeStatus)', version: '<version>' }
match responsefromsubscriber.InvokeStatus == 200
Examples:
| responseCode | version |
| 200 | v1 |
Feature File - 2
Given url internalGateway
print 'Version: ' , version
def LocalVersion = version
print 'LocalVersion: ' , LocalVersion
And path 'test/lambda-migration/#(LocalVersion)/quote'
And header Authorization = accessTokenforInvokation
When method get
This is not replacing #(LocalVersion) to v1
Upvotes: 1
Views: 6863
Reputation: 58088
And path 'test/lambda-migration/#(LocalVersion)/quote'
This is wrong. Please read this part of the docs: https://github.com/intuit/karate#rules-for-embedded-expressions
Also note that path
supports a comma-delimited form:
Try:
And path 'test/lambda-migration', LocalVersion, 'quote'
Upvotes: 1