Our test suite runs for about 25 minutes. Not the worst I've seen but not the same as another complex project we have that runs in 10 minutes. Both projects include unit, integrated and feature(UI) tests.

It is the feature tests than run the slowest. How could we speed them up?


Comparing complex projects is not really fair. One project maybe slow when used end-to-end, while the other is blazing fast. Sure there will be a difference in how fast your feature tests will run.

  • Run your tests in parallel in the cloud (Fast but costly)
  • Profile the tests and your application code
  • Analyse double coverage and try to move tests lower on the test-pyramide if possible

Measuring and researching is knowing. First analyse the slowest tests, execute it manually and check if the slowness is the application or the test. Optimize accordingly.

If you cannot optimize, run everything in parallel. If you build your tests to run in isolation this should be easy.

  • Review the test setups for slow code paths
  • Ensure tests still reflect active product functionality
  • See if different feature tests overlap what they are testing
  • Check for negative assertions that are waiting unnecessarily
  • Make sure factory girl is being used correctly (build vs. create)
  • Check for correct usage of js flag to run headless when possible
  • Check that vcr cassettes exist and aren't git ignored if vcr is being used
  • Review expectation for expect(page) that could be more specific in the locator
  • See if any separate tests can be combined into single tests with multiple assertions
  • Compare unit and user acceptance and see if unit tests can replace any user acceptance tests

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.