测试 Cucumber 的一项功能需要几分钟?
我已经安装了以下 gem 进行测试:
gem 'rspec-rails'
gem 'spork'
gem "factory_girl_rails"
gem "capybara"
gem "guard-rspec"
gem 'cucumber-rails'
gem 'database_cleaner'
我的所有测试都需要永远才能运行 - 使用 Cucumber 测试一项功能需要整整两分钟,而且这是在 Spork 与 prefork 中的几乎所有内容一起运行的情况下进行的。
测试本身上次运行花费了0.544s,但似乎正在运行cron.rake、rakefile,我不知道还有什么。我检查了这两个文件,它们似乎没有发生任何重要的事情。您对我如何改善这种情况有什么建议吗?
读数:
San-iMac:app san$ rake cucumber features/user_sessions.feature
WARNING: Nokogiri was built against LibXML version 2.7.8, but has dynamically loaded 2.7.3
Running cron.rake
begin Rakefile
/Users/san/.rvm/rubies/ruby-1.9.2-p0/bin/ruby -S bundle exec cucumber --profile default
Using the default profile...
WARNING: Nokogiri was built against LibXML version 2.7.8, but has dynamically loaded 2.7.3
Feature: User Sessions
...
I've got the following gems installed for testing:
gem 'rspec-rails'
gem 'spork'
gem "factory_girl_rails"
gem "capybara"
gem "guard-rspec"
gem 'cucumber-rails'
gem 'database_cleaner'
All my tests take forever to run - testing one feature with Cucumber takes a good two minutes, and this is with Spork running with nearly everything in prefork.
The test itself took 0.544s on the last run, but it seems to be running cron.rake, rakefile, and I don't know what else. I checked these two files and they don't seem to have anything significant going on. Do you have any pointers for how I can improve this situation?
The readout:
San-iMac:app san$ rake cucumber features/user_sessions.feature
WARNING: Nokogiri was built against LibXML version 2.7.8, but has dynamically loaded 2.7.3
Running cron.rake
begin Rakefile
/Users/san/.rvm/rubies/ruby-1.9.2-p0/bin/ruby -S bundle exec cucumber --profile default
Using the default profile...
WARNING: Nokogiri was built against LibXML version 2.7.8, but has dynamically loaded 2.7.3
Feature: User Sessions
...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我怀疑 Rake 是问题所在。如果您使用的是 Bundler,请尝试直接运行 cucumber,使用“bundle exec cucumber”,或者仅使用“cucumber”。
I suspect Rake is the problem. Try running cucumber directly instead, with "bundle exec cucumber" if you are using Bundler, or just "cucumber".
您使用的是 Windows 吗?我们注意到在 Windows 上启动 Cucumber 所需的时间比在 Linux 或 Mac 上要长得多。
我知道切换可能没那么容易,但每次旋转通常会节省几分钟。
Are you using windows? We've noticed it takes much longer to spin up cucumber on windows than linux or mac.
I appreciate it might not be that easy to switch, but it'll typically save a couple of minutes per spin up.