Karate-afterFeature - 主要特征文件不能使用 Karate-afterFeature 调用另一个特征文件 [英] Karate-afterFeature - main feature file cannot call another feature file using Karate-afterFeature

查看:39
本文介绍了Karate-afterFeature - 主要特征文件不能使用 Karate-afterFeature 调用另一个特征文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have a problem with Karate afterFeature configuration.

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

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.

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

The callonce works fine in prior step, but I have problem with the afterFeature.

这是我如何配置afterFeature的代码:

This is the code how I configure afterFeature:

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

推荐答案

建议使用 classpath: 前缀代替相对路径(很难做到正确).

Suggestion, instead of relative paths (which is hard to get right) use the classpath: prefix.

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

看起来解决方案是使用运行器而不是直接运行该功能.

looks like the solution was using a runner instead of running the feature directly.

这篇关于Karate-afterFeature - 主要特征文件不能使用 Karate-afterFeature 调用另一个特征文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆