[Solar-talk] tests in the browser
Travis Swicegood
developement at domain51.com
Wed Sep 20 07:33:25 PDT 2006
Hi all,
Clay Loveless wrote:
> From yesterday's threads, it seems like some folks are running Solar
> unit tests in the browser rather than on the command line.
>
> I'd never done that until this morning -- I'd always just run them on
> the command line, and based on that, don't think I'd have ever known
> about potential Apache crashes, etc.
>
> I tweaked the 'test.php' file in the dev branch a little bit to make
> output a little more readable, and to allow running a single test
> suite in a browser instead of the whole thing.
>
> For example:
>
> test.php?Solar_Markdown_Plugin_Html
>
>
> If a lot of people are running tests in the browser, I'd be
> interested to know about that...
What about using a reporter to handle the output for tests a la
SimpleTest? test.php could be your standard and it could do some
detection to figure out which reporter to run by default, but then it
gives the user a little more flexibility in how they view the test results.
Here's a sample API:
$suite = Solar::factory('Solar_Test_Suite', $config);
// setup reporter to display test output.
if ($_SERVER['HTTP_HOST]) {
$suite->setReporter(Solar::factory('Solar_Test_Reporter_HTML',
$config));
}
else {
$suite->setReporter(Solar::factory('Solar_Test_Reporter_Text',
$config));
}
// run the test series
$series = isset($argv[1]) ? trim($argv[1]) : null;
$suite->run($series);
Of course, this opens it up to all kinds of fun things. Email or SMS
reporters, an "upgrade" reporter that's used by a script that does an
svn update, runs the test and the reporter automatically knows to kill
the test on any failure, revert out the updated scripts, and report the
message via email/SMS. Another reporter we use at SimpleTest is the XML
reporter which can be used to chain tests together (I execute a test
script on my machine, it grabs the XML results from all of my servers,
parses those and reports back).
Anyhow, just some ideas for long term directions this could go.
-Travis
More information about the solar-talk
mailing list