Reputation: 383
I have been using a feature in my test which calls the retry function for calling an end point.
It used to work fine before but in last few days the same code has stopped working .
my code is :
Feature: Invoke External
Background:
* configure retry = { count: 5, interval: 5000 }
@parallel=false
Scenario: Invoke gateway
Given url externalGateway
And path domain + '/' + basepath + '/' + path
And header Authorization = accessTokenforProd
And request 'test'
When method requestMethod
Then retry until responseStatus == externalGatewayResponse
Then print ' response code from Qantas External Gateway: ' , responseStatus
and I am calling this feature with the following syntax:
Then def responseFromAuthenticatedExternalWSO2Gateway = call read('classpath:examples/Services/InvokeAuthenticatedProdQantasExternalWSO2Gateway.feature') {'domain': '#(domain)' , 'basepath': '#(basepath)' , 'path': '#(path)' , 'externalGatewayResponse': '#(externalGatewayResponse)' , 'method': '#(requestMethod)' , 'accessTokenforSandbox': '#(accessTokenforSandbox)' }
Then match responseFromAuthenticatedExternalWSO2Gateway.responseStatus == 200
Is there any issue with the syntax? If not , then have we made any changes which might affect the functioning of retry function ?
Upvotes: 1
Views: 559
Reputation: 58098
Please read the docs: https://github.com/intuit/karate#retry-until
You have got it wrong, the retry until
part should be before the method
step.
On a related note - especially when I see requestMethod
as a variable - I feel you have over-engineered your tests, which I strongly advise against. Avoid using call
except for setup kind of stuff - else you will end up with hard to maintain tests.
See this answer for details: https://stackoverflow.com/a/54126724/143475
Upvotes: 2