Redirecting TestRunner output from console to file

Discussion in 'Ruby' started by Vadim Dobrovolsky, May 6, 2009.

  1. Hi guys

    I'm novice both in Ruby and test/unit, so keep it in mind.

    I have the following question:
    How can I redirect the Test Runner output from console to some file or
    string variable?

    E.g.
    I run tests with the following arguments

    io=File.new('results.txt', 'w')
    tr=Test::Unit::UI::Console::TestRunner.new(Testcase,"VERBOSE",io)

    So Test IO should write to io variable but indeed it doesn't contain any
    test results.
    Ruby global variable $stdout is also empty. So it seems strange for me.

    If you know what's wrong with my code and assumptions or some other way
    how to get test results please answear.

    Thank you in advance.
    --
    Posted via http://www.ruby-forum.com/.
     
    Vadim Dobrovolsky, May 6, 2009
    #1
    1. Advertising

  2. Vadim Dobrovolsky

    Ryan Davis Guest

    On May 6, 2009, at 04:45 , Vadim Dobrovolsky wrote:

    > Hi guys
    >
    > I'm novice both in Ruby and test/unit, so keep it in mind.
    >
    > I have the following question:
    > How can I redirect the Test Runner output from console to some file or
    > string variable?
    >
    > E.g.
    > I run tests with the following arguments
    >
    > io=File.new('results.txt', 'w')
    > tr=Test::Unit::UI::Console::TestRunner.new(Testcase,"VERBOSE",io)


    Do the simplest thing that could possibly work:

    % ruby -Ilib test/test_blah.rb > results.txt
     
    Ryan Davis, May 6, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Edward Diener

    Creating a unittest TestRunner

    Edward Diener, Sep 5, 2004, in forum: Python
    Replies:
    0
    Views:
    669
    Edward Diener
    Sep 5, 2004
  2. hilbert00

    Redirecting output from console programs

    hilbert00, Jul 6, 2008, in forum: C Programming
    Replies:
    0
    Views:
    482
    hilbert00
    Jul 6, 2008
  3. drhilbert
    Replies:
    7
    Views:
    402
    drhilbert
    Jul 7, 2008
  4. Michael Neumann
    Replies:
    2
    Views:
    128
    Michael Neumann
    Nov 11, 2003
  5. Martin Ankerl

    colorized Test::Unit console testrunner

    Martin Ankerl, Sep 16, 2004, in forum: Ruby
    Replies:
    3
    Views:
    187
    Florian Gross
    Sep 16, 2004
Loading...

Share This Page