Running only a part of a huge (2000+) specs suite
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)
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
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