Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7995601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:27:47+00:00 2026-06-04T14:27:47+00:00

We’re developing an app on Ruby 1.9.3 and Rails 3.2.1. Recently, our unit tests

  • 0

We’re developing an app on Ruby 1.9.3 and Rails 3.2.1.

Recently, our unit tests have become sluggish at the beginning. It takes ~15 seconds for the invocations & executions to take place. Once I see “Execute test:units”, it takes another 10 seconds before I see any output. Finally, the task completes and tests only take 3 seconds to execute themselves.

3 seconds for unit tests is acceptable. 25 second load time isn’t realistic for BDD/TDD.

Here’s what happens when I run with rake test:units --trace:

** Invoke test:units (first_time)
** Invoke test:prepare (first_time)
** Invoke db:test:prepare (first_time)
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:abort_if_pending_migrations
** Execute db:test:prepare
** Invoke db:test:load (first_time)
** Invoke db:test:purge (first_time)
** Invoke environment 
** Execute db:test:purge
** Execute db:test:load
** Invoke db:test:load_schema (first_time)
** Invoke db:test:purge 
** Execute db:test:load_schema
** Invoke db:schema:load (first_time)
** Invoke environment 
** Execute db:schema:load
** Execute test:prepare
** Execute test:units

I wouldn’t doubt that the database schema being loaded, then re-loaded, might be a key source of slowness. However, I haven’t done anything to our Rakefile related to unit tests. Where can I peek to see what’s really happening under the hood?

This is what’s at the top of test/test_helper.rb:

require 'simplecov'
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'

What I’ve tried:

  1. Commenting out simplecov, as we only use that for our CI server, not during development (made no difference in execution time)
  2. Commenting out the other stuff, but that broke the tests from even executing. I’m not entirely sure why those other items are there, as I thought that the Rails environment would be loaded in “test” automatically.

Any ideas on where/how I can poke my head next to see?

Is there any chance that Rails is running migrations instead of just schema:load? As we develop, we have a large number of migrations (~30).

EDIT:

I am using a 2011-model Macbook Pro with 8G RAM and Core i7 – don’t think it’s my machine. I’ve seen in this question that on Windows, require can cause problems.

I’ve also considered that fixtures may be the problem, but if fixtures were the problem, the tests themselves, not the load time to the tests, would be slow, right?

EDIT 2:

Thanks to pchap10k’s answer I think that it has nothing to do with rake — it’s about our Gemfile. Maybe I should search in that area…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T14:27:49+00:00Added an answer on June 4, 2026 at 2:27 pm

    Could be your gems loading slowly. See this thread for similar complaints about slow rake load times in Rails 3.x > slow rails stack

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.