1

I have a suite of tests for a controller that makes calls to an external sandbox api for testing, which makes the performance rather slow. I'd like to improve performance by allowing parallel_tests to not only run suites in parallel, but individual describes.

For example:

RSpec.describe FooController do
    describe '#index' ...
    describe '#create' ...
end

Because the #index and #create tests do not share any memory space, it's fine to parallelize them. One option is:

RSpec.describe 'FooController#index' do
    describe '#index' ...
end

RSpec.describe 'FooController#index' do
    describe '#create' ...
end

but this makes the tests look awkward and a pain to read through. Is there a way I can easily have parallel_tests run each describe in parallel?

1 Answer 1

4

Turns out the maintainer of parallel_tests also has a gem designed just for this: https://github.com/grosser/parallel_split_test

After installing via gem install 'parallel_test_split' you can simply run parallel_split_test

Reduced a slow (but small) suite from 12 seconds to 6

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.