为什么我的黄瓜场景在步骤一起运行时会失败,但在单独运行时会通过?
当我将黄瓜场景作为一个整体运行时,或者使用命令:cucumber 我有 7 个失败的步骤。当我使用“正在进行的工作”标签单独运行它们时,它们通过得很好。
我不认为这是数据库状态问题..我正在使用事务运行,我也尝试在没有事务的情况下运行并使用数据库清理器清理数据库....仍然没有帮助。
我尝试运行调试器,但当我运行命令 cucumber 时它似乎不起作用。它仅在我使用正在进行的标签运行时才有效:cucumber -p wip
我认为可能是事情运行得太快而水豚没有正确检查事情?
有什么想法吗?
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.
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?
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尤里卡!我已经有一段时间遇到同样的问题了 - 我添加的越多,我的测试变得越来越慢 - 另外,一些测试会随机失败,但只有当作为一个整体套件运行时 - 在我的测试完成后,我只会运行再次特色和中提琴!一切都过去了。非常令人沮丧 - 但最令人沮丧的部分是速度 - 最近我升级到雪豹并将所有内容编译为 64 位。结果呢?我的测试时间从 7 分钟缩短到 32 分钟!
然而,有一个线索 - 64 位应用程序显然使用更多的内存来做同样的事情 - 然而,当我运行测试时,我的机器上的内存从未接近最大。提示#2? Webrat 运行得很快,只有当使用 culerity/celerity 测试 javascript 时,速度才真正变慢。
经过一番研究,我发现 jruby 告诉 java 给它最大的“堆大小”为 512 mbs。 JRuby 允许您在调用时设置 java 选项,并且 culerity 允许环境变量以您喜欢的任何方式调用 jruby。果然,大约在那个时候,java 将停止消耗内存,并且处理器将尝试自燃。那么你准备好了吗?它是:
JRUBY_INVOCATION="jruby -J-Xmx1024m" cucumber
这将我的堆大小增加到了 GB,而我的测试时间下降到了 7 分钟!是这样吗?我收到了吗?我当然希望它有帮助!
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!
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.
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" cucumber
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!