【问题标题】:Failed tests when calling feature file from inside a scenario do not show which scenario (in the called feature) failed从场景内部调用功能文件时失败的测试不显示哪个场景(在被调用的功能中)失败
【发布时间】:2017-12-06 01:22:26
【问题描述】:

我通过在场景中调用功能文件来重用它。上下文是我希望有一些共同的功能,我的所有端点都需要在common.feature 文件中进行测试。然后在特定端点的功能文件(endpoint.feature)中,我首先在一个场景中调用common.feature 文件,然后有其他特定于该端点的场景。

我的common.feature 文件如下所示:

Feature: ...  
Scenario: scenario 1  
Scenario: scenario 2  

我的endpoint.feature 文件如下所示:

Feature: ...
Scenario: test
  * call read('common.feature')
...

一切都按预期进行。 common.feature 文件中的场景被执行。问题是,如果来自common.featureScenario 1 失败,我会得到以下结果:

测试错误: * call read('classpath:common/common.feature')(Scenario: test): feature call failed: classpath:common/common.feature(..) 场景:测试:功能调用失败:classpath:common/common.feature(..)

空手道没有确切说明common.feature 中的哪个场景失败了。例如,如果我在 common.feature 中有 20 个场景,那么很高兴能准确地看到哪些场景失败了。

有什么方法可以让空手道准确列出被调用功能文件中哪些场景失败(在功能文件正常执行期间显示的方式)?

【问题讨论】:

  • 这是哪个版本的空手道? v0.6.1 有很多改进,您至少会看到哪个行号失败。如果我们缺少方案名称,请提出功能请求。
  • @Peter 我在 v0.6.1 上。是的,它显示了失败的行号。我将提出一个功能请求以显示场景名称(另外,完全爱上了空手道!)

标签: karate


【解决方案1】:

对于将来遇到此问题的任何人,此功能现在适用于 v >= 0.6.2

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-09-22
    • 1970-01-01
    • 2020-05-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-04
    相关资源
    最近更新 更多