首页 > 解决方案 > Karate-afterFeature - 主功能文件不能使用 Karate-afterFeature 调用另一个功能文件

问题描述

afterFeature我对空手道配置有疑问。

我想在每个场景之后从单独的功能文件中调用一个清理步骤。因此,我配置了一个afterFeaturejs 函数,它应该使用 karatescall函数调用该清理功能。

在前面的callonce步骤中工作正常,但我对afterFeature.

这是我如何配置的代码afterFeature

    * def result = callonce read('../callOnceCreateCompanyForBrowse.feature')
    * def id = result.response.data.createCompanyEvent.id
    * configure afterFeature = function(){ karate.call('../../deleteCompanyEvent.feature', {id : id}); }

标签: graphqlkarate

解决方案


建议,而不是相对路径(很难正确)使用classpath:前缀。

* configure afterFeature = function(){ karate.call('classpath:com/myco/deleteCompanyEvent.feature', { id: id }) }

编辑:看起来解决方案是使用跑步者而不是直接运行该功能。


推荐阅读