How to speed up load time when testing?

I’ve stuck with the defaults on my first Hanami project. Namely Minitest::Spec. I’m trying to get into the BDD flow but find the 8 second startup time to run a single test a little slow. I know, Rails is no better but it does at least have Spring, Spork, etc.

Has anyone looked into speeding things up? Could we get different groups of tests to require more specific parts of the framework?

Happy to do some investigation but if anyone has a starting point or ideas to help kick things off I would appreciate it.

As a Rails developer of 10 years I’m lovin’ the clean design of this framework. Great job!

Many thanks,
Fullstack Ruby developer
London, England.

Okay to partially answer my own question for an Interactor spec all I needed was:


require 'spec_helper'


require 'minitest/autorun'
require_relative '../../../lib/project/interactors/class_under_test'

I’m assuming other types of tests will require more of the framework but it’s a good start.

Hi @PhilT,
Sorry for the late reply. May I ask you how many bundled gems do you have in Gemfile.lock?

No problem at all!

Here’s the Gemfile, however I’ve tried just requiring the bare minimum and that doesn’t seem to affect load time:

source ''

gem 'bcrypt'
gem 'hanami', '~> 1.0'
gem 'hanami-model', '~> 1.0'
gem 'pg'
gem 'rake'
gem 'slim'

group :development do
  gem 'rubocop'
  gem 'shotgun'

group :test, :development do
  gem 'dotenv', '~> 2.0'
  gem 'pry', require: false

group :test do
  gem 'capybara'
  gem 'capybara_minitest_spec'
  gem 'chromedriver-helper'
  gem 'minitest'
  gem 'selenium-webdriver'

I should also mention that I’m running on Ubuntu on Windows which will probably also affect load time. I’ll try on a VM when I get a chance.

Apologies, it must indeed be due to running on Ubuntu on Windows. I’ve just run the same project on an Archliunx VM and the tests take barely a second. Back to a VM for me I think.

It looks like there are some suggested workarounds related to Rails load times and /tmp location. I’ll post if I find a solution.

Thanks again.