如果使用空手道在功能文件中满足条件,如何跳过后续步骤

How to skip next steps if a condition is fulfilled in a feature file using karate

我的功能文件看起来像这样:

#Subscribe to an API

Given url applicationURL

And path 'subscriptions'

And header Authorization = subscribeToken

And request {'tier': 'Gold','apiIdentifier': '#(APIIDStr)','applicationId': '#(applicationId)'}

When method post

Then status 201

* def subscriptionId = response.subscriptionId

* print 'subscriptionID is ', subscriptionId 

* def status = response.status

* print 'subscribed with status ', status , ' and subscriptionID ' , subscriptionId

#* eval if (response.status == 'ON_HOLD') karate.call('BPSWorkflow.feature')

Given url applicationURL + '/applications/generate-keys?'

And param applicationId = applicationId

And header Authorization = subscribeToken

And request {"validityTime": "3600","keyType": "PRODUCTION","accessAllowDomains": ["ALL"]}

When method post

Then status 200

* def accessTokenforInvokation = 'Bearer '+ response.token.accessToken

* print 'accessTokenforInvokation is ', accessTokenforInvokation 

我想跳过“#* eval if (response.status == 'ON_HOLD') karate.call('BPSWorkflow.feature')”之后的每一步状态是'ON_HOLD'.

有人可以帮忙吗?

有一个实验性的 API 您可以使用 karate.abort() - 这是文档:https://github.com/intuit/karate/tree/master/karate-netty#karateabort

这将在下一个版本中变得更加明显和更好地记录。

* eval if (response.status == 'ON_HOLD') { karate.call('BPSWorkflow.feature'); karate.abort() }