Save 36% for Black Friday! Learn more

Ask A Question

Notifications

You’re not receiving notifications from this thread.

Running only a part of a huge (2000+) specs suite

makaroni4 asked in Testing

I'm working on a Rails app with 2000+ feature specs. That's a lot and takes 45+ min to run (8min when running in parallel containers).

What are the strategies to speed this up? Is there a smart way to partially run a spec suite? (for example, run only checkout flow specs if one of checkout flow controllers/models/views were changed)

Reply

You can tag specs, say for specs related to checkout flow, you can tag them as "checkout" like this :

# specs/discount_checkout_spec.rb
it "should checkout with discount", :checkout do
    # some test code here
end

then you can specify rspec to only run tests are tagged with :checkout like this : rspec spec --tag checkout

Reply

In addition to what Axel wrote earlier, you could also add a focus-tag to specific cases, should you only want to test them individually. It works like so:

# specs/discount_checkout_spec.rb
it "should checkout with discount", focus: true  do
    # some test code here
end
Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 87,110+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.