开发者

How long should it take to run a Cucumber Scenario?

I'm running a Rails 3 app on a Windows box, that includes the following Cucumber scenario -

Scenario: Creating a project
Given I am on the homepage
When I follow 开发者_JAVA百科"New Project"
And I fill in "Name" with "TextMate 2"
And I press "Create Project"
Then I should see "Project has been created."

(the scenario is taken from the Manning "Rails 3 In Action" book). When I run the 'bundle exec cucumber' command I have to wait roughly forty seconds until I receive a result (there is currently only one scenario in my project - so it's taking 40 seconds to run a single scenario). I'd hoped to get feedback much faster via Cucumber tests. Is slow feedback from Cucumber just a fact of life or is there a way of speeding things up?


I have a very similar project with one cucumber scenario and it takes 39 seconds to run it on my Windows machine.

The problem is that ruby is not optimized to run on Windows. Some info is here http://en.wikibooks.org/wiki/Ruby_Programming/Installing_Ruby#Windows_is_slow.

My solution for this problem is installing Ubuntu on a VirtualBox and doing all Rails development inside it. It's a good compromise while I'm still not comfortable to work on Ubuntu all the time. The same cucumber scenario takes 10 seconds to run on the virtual Ubuntu, which is more or less acceptable.

On a "real" Ubuntu installation it takes 7 seconds.


Hey there, I'm one of the authors for this book so I think I'd be able to at least provide some insight to the question.

I'm writing the book using Mac OS X and when I run this scenario with the time UNIX command:

time bundle exec cucumber features/creating_projects.feature

I get this output:

0m1.196s

real    0m10.741s
user    0m9.195s
 sys    0m1.519s

The first time's output is from Cucumber and indicates the scenario took 1.196 seconds to run from top to toe. The real time here indicates how long the entire process took, which means everything including loading Rails and all the associated gems. Around about 10 and a half seconds.

So this means that scenario should be running just as fast for you. It isn't, and I'm not sure why not and I am unable to test it because I don't have a Windows box to test on.

The answer may lie in how you installed Ruby, although I am not 100% certain right now.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜