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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:41:00+00:00 2026-05-24T09:41:00+00:00

Imagine I have a test like this: class MyUnitTest < Test::Unit::TestCase def test_first #

  • 0

Imagine I have a test like this:

class MyUnitTest < Test::Unit::TestCase
  def test_first
    # test code here
  end

  def test_second
    # test code here
  end

  def test_third
    # test code here
  end
end

My test cases are destructive, and I need to regenerate the input in between tests. Therefore, it would be useful to run only one test case at a time. Currently, my approach is to comment tests that I don’t want executed, but surely there must be a better way?

So, for example, how do I run only test_first when I execute my test?

  • 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-24T09:41:01+00:00Added an answer on May 24, 2026 at 9:41 am

    Use --name PATTERN argument in order to filter out test names you want to run.

    D:\Projects>ruby test.rb
    Loaded suite test
    Started
    ...
    Finished in 0.000000 seconds.
    
    3 tests, 0 assertions, 0 failures, 0 errors, 0 skips
    
    Test run options: --seed 39768
    
    D:\Projects>ruby test.rb -n test_first
    Loaded suite test
    Started
    .
    Finished in 0.000000 seconds.
    
    1 tests, 0 assertions, 0 failures, 0 errors, 0 skips
    
    Test run options: --seed 53891 --name "test_first"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's imagine that I have something like this: <html> ... <div> <iframe src=test.html hash=r4d5f7></iframe>
Imagine I have table like this: id:Product:shop_id 1:Basketball:41 2:Football:41 3:Rocket:45 4:Car:86 5:Plane:86 Now, this
I have 1 unit test method that needs several parameters. I would like to
I have a XML file like this: <Document> <Tests> <Test> <Name>A</Name> <Value>1</Value> </Test> <Test>
I am unit testing mercurial integration and have a test class which currently creates
imagine something like this: import class B.*; interface A supports A.testSum { int sum(
Imagine I have a chunk of initialisation code at the top of a stored
I have a test method created using Selenium, something similar to this: [TestFixture] public
Consider the following code: <html> <head></head> <body> <div id='test' class='blah'> <a href='http://somesite.com/' id='someLink'>click!</a> </div>
Quirky question: Imagine that I have a base class called BaseFoo. I have an

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.