开发者

Rails Integration Tests: reducing execution time

I want to share my finding and hear from others about successful and failed attepts to reduce execution time of integration tests of Rails applications (be it 'ordinary' tests, Cucumber- or RSpec-based).

The question implies that tests involve database, view rendering, and maybe Jav开发者_如何学CaScript/AJAX. E.i. test don't stub/mock slow parts of the application.


Author's answer. I tried two things: spork plug-in and in-memory database. My dev configuration: Ubuntu VirtualBox hosted on Win7, Ruby 1.8.7, Rails 3, SQLite.

Spork plug-in reduced launch time of my tests from 35 seconds to 2 seconds. I summarized here steps, but they are described in github readme good enough. This post also describes how to use it with Guard to ensure spork server restarting when files change.

I tried to use in-memory database to reduce execution time. They in some cases reduce execution time by 10%, but have 2 sec overhead to launchtime to create schema. And results very more then i could observe improvement. So I decided for myself that improvement is not worth the trouble.

Also I used RVM to replace Ruby 1.8.7 with 1.9.2. It reduced execution time from 58 to 42 seconds.

Conclusion: Spork and replacing 1.8.7 with 1.9.2 can significantly improve your TDD experience.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜