A project that is fairly huge in size, where Swapnil is working currently, has huge code base along with tons of specs / test. It has roughly 1000 specs and tests (yes you read it correct 1K tests).

The test suite executes in 4 mins, with parallel setup, and 8 mins without parallel.

Here are tips and inputs Swapnil shared that helped to bring down the test / specs execution time.

Ways and Approach

  1. remove database cleaner

  2. stub all the API calls

  3. no VCR or very less of it

  4. webmock wherever possible

  5. use fixture_builder

Parallel Testing

Rohan) How to run in parallel and it won't repeat same tests to execute twice ?

Swapnil) No it wont. It will use the number of cores on a machine and divide the tests evenly among them. It needs a smart setup and create n test db for n cores.

Fairly simple though. Theres a gem "parallel_tests" https://github.com/grosser/parallel_tests

The primary thing to take care is deadlock. If that is handled it works awesome. But the major factor in my projects to speedup were # 1 and #5 mentioned above.

I hope other projects can benefit from these inputs.