From: patrick-may@... (Patrick May) Date: 2002-07-15T17:22:43+09:00 Subject: Re: Has anyone combined Test::Unit with CGI? Dossy wrote in message news:<20020715023521.GH24646@panoptic.com>... > Just as it auto-magically > runs the test runner by simply requiring 'test/unit' and defining > a class that inherits from Test::Unit::TestCase, I'm thinking if > you require 'cgi' -- well, if a class named "CGI" is defined -- that > the Test::Unit test runner generates its output as a HTML > document. Would something like this work: print "Content-type: text/html\r\n" print "\r\n" print "
"

.... run tests, do output here ...

print "
" It would make your shell run test output uglier, but I think this should work online. Alternatively, you could have two seperate entry points to the application, one of which was a cgi: run_my_tests.rb cgi_run_my_tests.rb I don't think it's simple to autodetect whether a script is running within a cgi enviroment. Look at the code for the QueryExtension module within cgi for the enviroment checking code. ~ Patrick