如果使用空手道在特征文件中满足条件,如何跳过下一步

时间:2018-09-04 03:07:04

标签: dsl 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如果(response.status =='ON_HOLD')karate.call('BPSWorkflow.feature')“状态为'ON_HOLD',我想跳过每一步。

有人可以帮忙吗?

1 个答案:

答案 0 :(得分:0)

有一个实验性的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() }