Redirecting TestRunner output from console to file

  • Thread starter Vadim Dobrovolsky
  • Start date

V

Vadim Dobrovolsky

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.
 
Ad

Advertisements

R

Ryan Davis

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top