Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible use Guard in combination with parallel tests?

I've been looking at ways of speeding up my testing using some sort of parallel tests in combination with my current Guard setup. Guard-Hydra seemed like a good start but the Hydra gem itself is no longer maintained and the author directs people to parallel_tests instead.

Parallel tests seems very good. I got it working at the command line using the usual rake task, but I'm not capable of writing an appropriate guard extension myself. I've been rather surprised about the lack on info available when searching for 'guard parallel_tests'. Surely I'm not the only Rails developer out there with a multi-core PC who would be interested in speeding their tests up?

like image 487
Simmo Avatar asked Nov 20 '12 09:11

Simmo


People also ask

Does RSpec run tests in parallel?

RSpec does not support Rails 6 built-in parallel testing.

What is parallel tests?

Parallel testing is a semi-automated testing process that relies on cloud technology and virtualization to perform tests against several configurations at the same time. The goal of this process is to resolve the limitations of time and budget while still assuring quality.

Why do we parallel test?

Parallel testing allows teams to perform automated tests against several configurations at the same time to scale downtime and budget constraints while allowing for increased test coverage and ensuring quality.


4 Answers

I've implemented this option on guard-rspec

https://github.com/guard/guard-rspec/pull/150

like image 108
rafael.lima Avatar answered Nov 08 '22 08:11

rafael.lima


There is now some information in the ReadMe of guard-rspec on how do to this here https://github.com/guard/guard-rspec (look right down the bottom). As of time of writing it looks like the following (note the comma's in the additional args)

rspec_options = {
  cmd: "bundle exec rspec",
  run_all: {
    cmd: "bundle exec parallel_rspec -o '",
    cmd_additional_args: "'"
  }
}
guard :rspec, rspec_options do
# (...)
like image 29
Mark Lakewood Avatar answered Nov 08 '22 08:11

Mark Lakewood


Actually, I looked into this recently and did not find a solution. It seems quite strange because really smart people sit around waiting for tests, when there are unused cores sitting idle.

Anyone who can come up with a solution to this would make a huge contribution to the Rails and Ruby community.

like image 42
B Seven Avatar answered Nov 08 '22 08:11

B Seven


I've also implemented this option on guard-rspec:

https://github.com/guard/guard-rspec/pull/325

Also worked with multitenancy:

http://pr0d1r2.tumblr.com/post/121591540433/parallel-tests-with-multitenancy-on-guard

like image 25
Marcin Nowicki Avatar answered Nov 08 '22 10:11

Marcin Nowicki