简体   繁体   English

在黄瓜功能文件上的几种情况下,有时有时不会执行后台步骤

[英]Background step sometimes never executes before few scenarios on a cucumber feature file

I saw a wired issue recently that Background step sometimes don't executes before few scenarios in a feature file. 我最近看到一个有线问题,即有时在功能文件中的少数情况下才执行后台步骤。 I have no idea why this is happened. 我不知道为什么会这样。 Any body saw this issue in cucumber ruby framework? 有人在黄瓜红宝石框架中看到了这个问题吗? Is there any limitations of scenario count on each feature file? 每个功能文件的方案计数是否有限制? In below examples, i saw Background step executes only for 1st 5 scenarios but not others. 在下面的示例中,我看到“后台”步骤仅对前5个方案执行,而对其他方案则不执行。

Feature: Something 功能:东西

Background: Given step 1 And step 2 背景:给定步骤1和步骤2

Scenario: a scenario When I do step 3 Then it works 场景:场景当我执行第3步时便可以使用

Scenario: another scenario When I do a different step 3 Then it works 方案:另一种方案当我执行其他步骤3之后,它就可以工作

Scenario: another scenario 4 When I do a different step 4 Then it works 方案:另一种方案4当我执行不同的步骤4然后它起作用

Scenario: another scenario 5 When I do a different step 5 Then it works 方案:另一种方案5当我执行其他步骤5时,它可以工作

If this is actually the case, then it would be a bug in cucumber and should be reported over at the cucumber project. 如果确实如此,那么这可能是黄瓜中的错误,应该在黄瓜项目中进行报告。 It's more likely that it is actually executing the background but you have requests still running at the end of previous tests that are modifying your database and making it look like the background isn't running. 它很有可能实际上是在执行后台,但是在修改数据库并使其看起来好像后台没有运行的先前测试结束时,您仍有请求正在运行。 You can test that by adding a step into the background that outputs something to the screen and then count how many times is is output. 您可以通过在背景中添加一个步骤来将某些内容输出到屏幕,然后计算输出的次数来进行测试。

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

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