简体   繁体   English

Karate-afterFeature - 主要特征文件不能使用 Karate-afterFeature 调用另一个特征文件

[英]Karate-afterFeature - main feature file cannot call another feature file using Karate-afterFeature

I have a problem with Karate afterFeature configuration.我的空手道afterFeature配置有问题。

I want to call a clean up step from a separate feature file after every scenario.我想在每个场景之后从单独的功能文件中调用清理步骤。 Hence, I configured a afterFeature js function, that should call that cleanup feature using karates call function.因此,我配置了一个afterFeature js 函数,它应该使用空手道call函数调用该清理功能。

The callonce works fine in prior step, but I have problem with the afterFeature . callonce在前面的步骤中工作正常,但我对afterFeature有问题。

This is the code how I configure afterFeature :这是我如何配置afterFeature的代码:

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

Suggestion, instead of relative paths (which is hard to get right) use the classpath: prefix.建议,而不是相对路径(很难做到正确)使用classpath:前缀。

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

EDIT: looks like the solution was using a runner instead of running the feature directly.编辑:看起来解决方案是使用跑步者而不是直接运行该功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM