On Fri, Dec 09, 2005 at 08:08:42PM +0100, Paul Johnson wrote:
> On Wed, Dec 07, 2005 at 11:23:15PM -0800, Luke Closs wrote:
> 
> > On Wed, Dec 07, 2005 at 12:49:41PM -0800, Troy Frever wrote:
> > > In browsing through the archives, it appears that this question has
> > > come up, but I have yet to find a nice packaged answer. So here it is
> > > again:
> > > 
> > > 1. Does anyone have a simple servelet or cgi script for processing the
> > > results sent to the postresults URL and writing them to a file (java
> > > or other cgi preferred, as opposed to .net)?
> > 
> > I've just added this functionality to the WWW-Selenium-Utils perl
> > package for you.  I probably won't get a chance to upload it today,
> > so I've attached a perl CGI script that should work for you.  You'll
> > probably want to change the default location it saves the results to.
> 
> Did you forget to attach it, or did the list strip it?

I've just uploaded WWW-Selenium-Utils-0.05 to the CPAN, and it
includes postResults.cgi.  Here is the script inline, however:

#!/usr/bin/perl
use strict;
use warnings;
use CGI;

write_results(CGI->new, '/tmp/selenium-results');
               
sub write_results {
    my ($q, $dest) = @_;

    open(my $fh, ">$dest") or die "Can't open $dest: $!";
    my $date = localtime;
    print $fh "Selenium results from $date\n";
    for my $p (qw(result totalTime numTestPasses numTestFailures
                  numCommandPasses numCommandFailures numCommandErrors
                  suite
                 )) {
        my $r = $q->param($p) || '';
        print $fh "$p: $r\n";
    }
    my $i = 0;
    while (1) {
        $i++;
        my $t = $q->param("testTable.$i");
        last unless $t;
        print $fh "testTable.$i: $t\n";
    } 
    close $fh or die "Can't write to $dest: $!";
}

-- 
Luke Closs
PureMessage Developer 
There is always time to juggle in the Sophos Zone.
_______________________________________________
Selenium-users mailing list
Selenium-users@lists.public.thoughtworks.org
http://lists.public.thoughtworks.org/mailman/listinfo/selenium-users

Reply via email to