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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:19:17+00:00 2026-05-24T19:19:17+00:00

I am trying to write fails and errors that occur in the test to

  • 0

I am trying to write fails and errors that occur in the test to a log file, so that they don’t appear on-screen, but it appears as though errors and assert failures write to STDOUT instead of STDERR. I have been unable to find information on how to redirect this output after hours of googling, and would greatly appreciate help.

  • 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-24T19:19:18+00:00Added an answer on May 24, 2026 at 7:19 pm

    Why should the errors not be on stdout?
    Up to now I have no prepared solution to suppress the output for specific errors.

    If you accept the unchanged output, I have a solution to store errors and failures in a file. It will be no problem to create a 2nd file for Notifications…

    gem 'test-unit'
    require 'test/unit'
    
    module Test
      module Unit
        class TestSuite
          alias :old_run :run
          def run(result, &progress_block)
            old_run(result, &progress_block)
            File.open('test.log', 'w'){|f|
              result.faults.each{|err|
                case err
                  when Test::Unit::Error, Test::Unit::Failure
                    f << err.long_display
                    f << "\n===========\n"
                  #not in log file
                  when Test::Unit::Pending, Test::Unit::Notification, Test::Unit::Omission
                  end
              }
            }
          end
        end
      end
    end
    
    
    class MyTest < Test::Unit::TestCase
    
      def test_1()
        assert_equal( 3, 1+1) #failure
      end
      def test_2()
        1 / 0 #force an error
      end
      def test_3()
        notify 'sss'
      end
      def test_4()
        pend "MeineKlasse.new"
      end
      def test_5
        omit 'aaa' if RUBY_VERSION == '1.9.2'
      end
    
      def test_5
        assert_in_delta( 0.1, 0.00001, 1.0/10)
      end
    
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a windows service. It installs fine, but fails when I
Trying to write a couple of functions that will encrypt or decrypt a file
I'm trying to write to a file a URL string that has the '&'
I'm trying write a query to find records which don't have a matching record
Trying to write a PowerShell cmdlet that will mute the sound at start, unless
Im trying to write a single byte at a certain location in a file.
im trying to write an app that will display a list off lines from
I'm trying to write a regex function that will identify and replace a single
I'm trying to write a UDF to translate a string that is either a
I am new to perl, but I am trying to write a plug-in for

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.