[Wtr-general] Need Help redirecting the Test Unit output

Sean Gallagher Sean.Gallagher at ticketmaster.com
Tue Apr 25 11:13:32 EDT 2006


Hi Paul,
Try tee on the command line when you kick off your script.

Like so:

C:\> ruby iostring_test.rb | tee results.out

tee.exe is included with GNU utilities for Win32, available here:
http://unxutils.sourceforge.net/


Sean



> -----Original Message-----
> From: wtr-general-bounces at rubyforge.org 
> [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Paul Carvalho
> Sent: Tuesday, April 25, 2006 7:49 AM
> To: wtr-general at rubyforge.org
> Subject: [Wtr-general] Need Help redirecting the Test Unit output
> 
> Hi there, I'm trying to capture the Test Unit output to a 
> file but I'm not exactly sure of what it is I need to 
> capture.  I thought it was STDOUT, but now I'm not so sure.  
> Here's an example of what I want...
> 
> In the Watir\Unittests\ folder, run the script: iostring_test.rb 
> 
> It has the following output:
> ----
> >ruby iostring_test.rb
> Loaded suite iostring_test
> Started
> ......
> Finished in 0.0 seconds.
> 
> 6 tests, 7 assertions, 0 failures, 0 errors
> >Exit code: 0 
> ----
> 
> This script redirects STDOUT (the 'puts' and 'prints') to 
> variables to work with them in the asserts.  That's neat, but 
> not what I want to do.
> 
> What I actually want to do is capture the *above* Test Unit 
> summary output to a file and ignore everything else.  I want 
> the "Loaded", "Started", "....", Finish time, and test summary. 
> 
> I've searched the Watir message archives, googled the web, 
> and skimmed through the PickAxe book, but so far I haven't 
> been able to figure out how to do this.  I browsed through 
> some of the code in C:\ruby\lib\ruby\1.8\test\unit but I 
> haven't deciphered it yet. 
> 
> Does anyone know how to redirect this Test Unit output?  Are 
> there any additional sources that I can refer to for changing 
> the Test Unit framework so that it writes this info to a file?
> 
> Paul.
> 
> 
> 



More information about the Wtr-general mailing list