From: Robert Klemme Date: 2006-03-20T19:39:02+09:00 Subject: Re: capturing the stdout Navya Amerineni wrote: > Hi all, > > I am running a test case and need it capture the output it gives me. > > require 'stringio' > old_stdout = $stdout > $stdout = StringIO.new > ........... > @reqout = $stdout.string > $stdout = old_stdout > > > the above code captures the stdout if something written explicily (like puts). > but it doesnot capture the output or running a testcase. > i want to capture the results if the testcases. > is there a way it could be done. You probably must redirect $defout also. Other than that doing it externally (i.e. in the calling process) might be an option, too. Kind regards robert