开发者

How do I run Cucumber steps concurrently in Ruby?

开发者 https://www.devze.com 2023-01-18 18:41 出处:网络
In our Cucumber steps, we would like to start a long running task in one step and check that the task is running and that it set up the UI for the task correctly, in another step. Checking the UI must

In our Cucumber steps, we would like to start a long running task in one step and check that the task is running and that it set up the UI for the task correctly, in another step. Checking the UI must be done while the first step is still running. Our Cucumber looks similar to this:

Given I start my long running task  
And I navigate to application status page  
Then I should see "Status" in the html  

We are using the DelayedJob gem to complete our long running tasks and currently run Delayed::Job.work_off in a new thread.

What is the best way to run steps concurrently with Cucum开发者_StackOverflow中文版ber?

Is there an officially supported way to do this?


You may want to take a look at

Spork

http://github.com/timcharper/spork

or Hydra

http://github.com/ngauthier/hydra

I am not entirely sure, that you can run steps in parallel. Features/scenarios you can. I am assuming this because of the long running task right ?

If my assumption is correct, Delayed::Job.work_off is the best way, if that is taking really long, you can mock/stub the process. Test the worker/process separately, this way your scenarios can run without any delay, and you delayed job is tested separately. ( This can be analogues to testing models and controllers separately)

0

精彩评论

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

关注公众号