首页 > 解决方案 > 为什么我们在空手道报告中使用 karate.abort() 将“跳过步骤”视为“失败的步骤”?

问题描述

对于我的测试场景,我正在使用“karate.abort()”函数,如果满足条件,这将跳过它下面的步骤。但由于跳过了步骤,这将我的完整测试标记为失败。

如果调用 karate.abort() 并跳过下一步,有什么方法可以将测试用例标记为通过?

例子:

场景大纲:ARN 无效时的 Lambda API 注册

Given url ApiAdminURL

And path AdminPath

And header apigateway-apikey = apiGatewayKey

And header apigateway-basepath = 'lambda-migration'

* json myReq = read('swagger-lambda.json')

* set myReq.apiConf.subscriptionTiers = <subscriptionTiers>

* set myReq.swagger.info.title = 'REGTEST_AUTO_Regression_Lambda_Quote_Function'

* set myReq.swagger.basePath = 'lambda-migration'

* set myReq.swagger.info.version = 'v1'

* set myReq.swagger.x-lambda-arn = '<arn>'

And request myReq

When method post

Then status <responseCode>

* eval if (responseStatus == 400) karate.abort()

* call read('Lambda-Sleep.feature')

* call read('Lambda-APIDefinition.feature')

* def responsefromsubscriber = call read('Lambda-Subscriber.feature')

 {accessTokenforInvokation: '#(accessTokenforInvokation)', applicationId: '#

 (applicationId)', subscribeToken: '#(subscribeToken)'}

* def AccessTokenforInvokation =

  responsefromsubscriber.accessTokenforInvokation

* def ApplicationId = responsefromsubscriber.applicationId

* def SubscribeToken = responsefromsubscriber.subscribeToken

标签: dslkarate

解决方案


这是在补丁版本中修复的错误:https ://github.com/intuit/karate/issues/464

你能不能把你的空手道版本升级到 0.8.0.1 再试一次。


推荐阅读