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 6119251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:31:52+00:00 2026-05-23T15:31:52+00:00

I often run the various test groups like: rake test:units rake test:functionals I also

  • 0

I often run the various test groups like:

rake test:units
rake test:functionals

I also like to run individual test files or individual tests:

ruby -Itest test/unit/file_test.rb
ruby -Itest test/unit/file_test.rb -n '/some context Im working on/'

There’s also:

rake test TEST=test/unit/file_test.rb

And I’ve even created custom groupings in my Rakefile:

  Rake::TestTask.new(:ps3) do |t|
    t.libs << 'test'
    t.verbose = true
    t.test_files = FileList["test/unit/**/ps3_*_test.rb", "test/functional/services/ps3/*_test.rb"]
  end

What I haven’t figured out yet is how to run multiple ad-hoc tests at the command line. In other words, how can I inject test_files into the rake task. Something like:

rake test TEST=test/unit/file_test.rb,test/functional/files_controller_test.rb

Then I could run a shell function taking arbitrary parameters and run the fast ruby -Itest single test, or a rake task if there’s more than one file.

  • 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-05-23T15:31:52+00:00Added an answer on May 23, 2026 at 3:31 pm

    I ended up hacking this into my RakeFile myself like so:

    Rake::TestTask.new(:fast) do |t|
      files = if ENV['TEST_FILES']
        ENV['TEST_FILES'].split(',')
      else
        FileList["test/unit/**/*_test.rb", "test/functional/**/*_test.rb", "test/integration/**/*_test.rb"]
      end
    
      t.libs << 'test'
      t.verbose = true
      t.test_files = files
    end
    Rake::Task['test:fast'].comment = "Runs unit/functional/integration tests (or a list of files in TEST_FILES) in one block"
    

    Then I whipped up this bash function that allows you to call rt with an arbitrary list of test files. If there’s just one file it runs it as ruby directly (this saves 8 seconds for my 50k loc app), otherwise it runs the rake task.

    function rt {
      if [ $# -le 1 ] ; then
        ruby -Itest $1
      else
        test_files = ""
        while [ "$1" != "" ]; do
          if [ "$test_files" == "" ]; then
            test_files=$1
          else
            test_files="$test_files,$1"
          fi
          shift
        done
        rake test:fast TEST_FILES=$test_files
      fi
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am experimenting with parser combinators and I often run into what seems like
I often need to run reduce (also called foldl / foldr, depending on your
Especially for C# Unit Testing , how to make a test run for various
I often run into the following problem. I work on some changes to a
I often run into the problem that I have one stream full of data
I often run into code that has to perform lots of checks and ends
I often run into the situation where I want to disable some code while
Something that I often run into with my users is their desire to aquire
One of the problems I often run into, is that I will include '
When you start messing around with Spring's auto-proxy stuff, you often run into this

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.