Re: [Wtr-general] Reporting suggestions?
If you don't need the console output to be real-time, perhaps you could use the following as a launcher script? IO.sync = true out_file = File.new('test_output.log', 'w') ret = `ruby test_main.rb` $stdout ret out_file ret out_file.close ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Reporting suggestions?
Tiffany, If you want to dig a little into the Watir internals, you can do this easily enough. Find the Watir method(s) that produce the output for the tests. Then override those methods (just use copy/paste) in your own custom module of the same name. Then in your copied method, change the "puts" (or whatever it happens to be) to output the resluts any way you want. Put your module somewhere in an accessible directory (/lib is a good place), and 'require' it either in your controller(s), or in application.rb if you want all controllers to see it. I realize that was a pretty generic explanation, but it is not as difficult as it sounds. But it is best to override the methods in question rather than editing the existing Watir code. The only problem might be if each test did its own output. That would not be very DRY, and you would have a lot to override. I haven't looked at it, but I doubt that is the case. Lonny Eachus Subject: [Wtr-general] Reporting suggestions? From: Tiffany Fodor [EMAIL PROTECTED] Date: Fri, 06 Jul 2007 11:19:47 CDT To: wtr-general@rubyforge.org To: wtr-general@rubyforge.org Hi all! I'm trying to determine the best way to collect the results of my tests. I'm using Test::Unit methods for my harness and will have about 15-20 data-driven tests that get information from an excel spreadsheet for use in each test. I have lots of 'verify' statements that check various conditions and post messages for failed conditions as well as progress statements I generate with simple 'puts' commands. Ideally, I'd like all of the results ('puts' statements as well as the Test::Unit results) to be echoed to the command prompt and copied to a log file. I can't find a good way to do this other than copy/paste. I could write any 'puts' statements to a file as well as the command prompt, but I'm not sure how to capture the Test::Unit results. I did a web search and the only real answer I found on capturing command line output with Ruby was "don't". Any suggestions would be appreciated! Thanks! -Tiffany ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Reporting suggestions?
I'd suggest using ci-reporter - http://rubyforge.org/projects/caldersphere/- for your main test reporting, though honestly I've got little experience with it and am still using it's predecessor test-unit report. For your puts statements why not use ruby's logger or log4r instead? Dump your puts statements and replace them with log calls to a file. Log4R: http://log4r.sourceforge.net/ Logger is part of ruby, there are examples of subclassing and usage inside Watir.rb -Charley On 7/6/07, Chong [EMAIL PROTECTED] wrote: If you don't need the console output to be real-time, perhaps you could use the following as a launcher script? IO.sync = true out_file = File.new('test_output.log', 'w') ret = `ruby test_main.rb` $stdout ret out_file ret out_file.close ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Reporting suggestions?
you can use 'tee' program. It's part of cygwin distribution if you have that installed. it can capture everything from the stdout to a file if you pipe it from the command line. So when you run a test append | tee somefile.txt to dump your stream in there. like so.. promptts_mysuite.rb | tee -a test_reports.txt http://www.ss64.com/bash/tee.html On 7/6/07, Tiffany Fodor [EMAIL PROTECTED] wrote: Hi all! I'm trying to determine the best way to collect the results of my tests. I'm using Test::Unit methods for my harness and will have about 15-20 data-driven tests that get information from an excel spreadsheet for use in each test. I have lots of 'verify' statements that check various conditions and post messages for failed conditions as well as progress statements I generate with simple 'puts' commands. Ideally, I'd like all of the results ('puts' statements as well as the Test::Unit results) to be echoed to the command prompt and copied to a log file. I can't find a good way to do this other than copy/paste. I could write any 'puts' statements to a file as well as the command prompt, but I'm not sure how to capture the Test::Unit results. I did a web search and the only real answer I found on capturing command line output with Ruby was don't. Any suggestions would be appreciated! Thanks! -Tiffany ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general