为什么我的黄瓜场景在步骤一起运行时失败,但在单独运行时通过? [英] Why are my cucumber scenarios failing when steps are run together, but pass when run singularly?

查看:16
本文介绍了为什么我的黄瓜场景在步骤一起运行时失败,但在单独运行时通过?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我作为一个整体运行我的黄瓜场景时,或者使用以下命令:黄瓜我得到 7 个失败的步骤.当我使用正在进行的标记单独运行它们时,它们可以正常运行.

When I run my cucumber scenarios as a whole, or with the command: cucumber I get 7 failing steps. When I run them individually with the work in progress tag they pass fine.

我不认为这是数据库状态问题.我正在运行事务,我也尝试在没有事务的情况下运行并使用数据库清理器清理数据库......仍然没有帮助.

I don't think it's a database state issue.. I'm running with transactions and I also tried running without and cleaning the database with database cleaner.... still does not help.

我尝试运行调试器,但是当我运行命令 cucumber 时它似乎不起作用.它仅在我使用正在进行的工作标签运行时才有效:cucumber -p wip

I tried to run the debugger but it does not seem to work when I run the command cucumber. It only works when I run with the work in progress tag: cucumber -p wip

我认为可能是事情运行得太快了,水豚没有正确检查事情?

I thought it might be that things are running too fast and capybara is not checking things properly?

有什么想法吗?

推荐答案

Eureka!我遇到同样的问题已经有一段时间了——我添加的越多,我的测试就越慢——而且,一些测试会随机失败,但只有当作为一个整体运行时——在我的测试完成后,我会运行功能再次和中提琴!都过去了.非常令人沮丧 - 但最令人沮丧的部分是速度 - 最近我升级到雪豹并将所有内容编译为 64 位.结果?我的测试从 7 分钟缩短到 32 分钟!

Eureka! I've been having this same problem for awhile now - my tests got slower and slower the more I added - also, some tests would fail randomly, but only when run as a whole suite - after my tests would finish I would just run the feature again and viola! all passing. Very frustrating - but the MOST frustrating part was the speed - recently I upgraded to snow leopard and compiled everything to 64bits. The result? My tests went from taking 7 minutes to 32!

但是,有一个线索 - 显然,64 位应用程序使用更多内存来做同样的事情 - 但是,当我运行我的测试时,我的机器上的内存永远不会接近最大值.提示#2?Webrat 的速度很快,只有在使用 culerity/celerity 测试 javascript 时,事情才真正变慢.

There's a clue in that however - 64 bit apps use more memory to do do the same thing, apparently - however, when I was running my tests the memory on my machine was never coming close to maxing out. Hint #2? Webrat was going fast, it was only when using culerity/celerity to test javascript that things were really slowing down.

在四处寻找之后,我发现 jruby 告诉 java 给它一个最大的 512 mbs 的堆大小".JRuby 允许您在调用它时设置 java 选项,并且 culerity 允许环境变量以您喜欢的任何方式调用 jruby.果然,在那个时候,java 会停止消耗内存,处理器会尝试着火.那么你准备好了吗?这里是:

After poking around I found out that jruby tells java to give it a maximum 'heap size' of 512 mbs. JRuby allows you to set java options when it is invoked, and culerity allows an environment variable to invoke jruby any way you like. Sure enough, around that time, java would stop consuming memory and the processor would try to set itself on fire. So are you ready? Here it is:

JRUBY_INVOCATION="jruby -J-Xmx1024m" 黄瓜

这将我的堆大小增加到了 1 GB,我的测试时间下降到了 7 分钟!是这样吗?我得到了吗?我当然希望它有所帮助!

That increased my heap size to a gigabyte and my test time dropped down to 7 minutes! Is that it? Did I get it? I sure hope it helps!

这篇关于为什么我的黄瓜场景在步骤一起运行时失败,但在单独运行时通过?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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