为什么我的黄瓜方案在同时运行时会失败,但是在单步运行时会失败? [英] Why are my cucumber scenarios failing when steps are run together, but pass when run singularly?

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

问题描述

当我整体运行我的黄瓜方案时,或使用以下命令:黄瓜
,我将获得7个失败的步骤。当我分别用正在进行的工作标签运行它们时,它们会通过。



我认为这不是数据库状态问题。我正在运行事务,并且还尝试了运行而不使用数据库清理程序来清理数据库。...仍然没有帮助。



我尝试运行调试器,但是当我运行调试器时似乎无法正常工作运行命令黄瓜。仅当我使用正在进行的工作标签运行时,它才起作用: cucumber -p wip



我认为可能是

有什么想法吗?

解决方案

尤里卡!我已经有相同的问题一段时间了-添加的越多,我的测试就变得越来越慢-此外,有些测试会随机失败,但只有在整个套件中运行时-测试完成后,我才运行再次功能和中提琴!全部过去。非常令人沮丧-但最令人沮丧的部分是速度-最近我升级到了雪豹并将所有内容编译为64位。结果?我的测试时间从7分钟提高到了32分钟!



但是有一个线索,就是-64位应用程序显然会使用更多的内存来做同样的事情-但是,当我运行测试时,机器上的内存从来没有接近最大化。提示2? Webrat的发展很快,只有在使用文化/速度来测试javascript时,事情才真正放慢了速度。



在四处寻找之后,我发现jruby告诉Java给它的最大堆大小为512 mbs。 JRuby允许您在调用它时设置java选项,而culerity则允许环境变量以您喜欢的任何方式调用jruby。可以肯定的是,在那段时间左右,java将停止消耗内存,而处理器将尝试着火。那你准备好了吗?这里是:



JRUBY_INVOCATION = jruby -J-Xmx1024m黄瓜



这使我的堆大小增加到了千兆字节,而我的测试时间减少到了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.

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?

解决方案

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!

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

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