Re: automated web testing with selenium

2005-11-29 Thread Mattia Barbon \[EMAIL PROTECTED]
 On 2005-11-02, Luke Closs [EMAIL PROTECTED] wrote:
 
  Also, yesterday Test::WWW::Selenium was uploaded to CPAN, so Selenium
  can now be driven by perl!

 Test::WWW::Selenium seems interesting, but I could use an example it
 would be useful to use, versus the standard techniques.

  It is useful when you want to test Javascript code, for example
to test that your client-side validation is working properly,
or that your onclick handlers are working properly.

  From the docs, it's not clear if there are restrictions about where
 the related Perl testing code must reside. Does it need to be on the
 same server as Selenium and the application?

  There are no restrictions: you can have the testing code
on one server, the selenium_server (which acts as a reverse-proxy
to the application under test) on another server and the
application under testing on a third server. Note that
the server where the testing code is run most be able to launch
a web browser. It is more convenient if testing code and
selenium_server are on the same machine, but this is not a
requirement.

Regards
Mattia

P.S.: please note that you can not have multiple tests running
  concurrently and using the same selenium_server




Extra Tests for Test::Run (and evidently Test::Harness)

2005-11-29 Thread Shlomi Fish
Hi all!

These are some extra test files that I added to Test::Run, and possibly could 
be integrated into Test::Harness after some modification:

t/output.t:


#!/usr/bin/perl -w

BEGIN {
if( $ENV{PERL_CORE} ) {
chdir 't';
@INC = ('../lib', 'lib');
}
else {
unshift @INC, 't/lib';
}
}

use strict;

use Test::More tests = 2;

use Test::Run::Obj;

{
open ALTOUT, , altout.txt;
open SAVEOUT, STDOUT;
open STDOUT, ALTOUT;

my $tester = Test::Run::Obj-new(
test_files = [t/sample-tests/simple],
);

$tester-runtests();

open STDOUT, SAVEOUT;
close(SAVEOUT);
close(ALTOUT);

my $text = do { local $/; local *I; open I, , altout.txt; I};

# TEST
ok (($text =~ m/All tests successful\./), 'All tests successful.' string 
as is);
}

# Run several tests.
{
open ALTOUT, , altout.txt;
open SAVEOUT, STDOUT;
open STDOUT, ALTOUT;

my $tester = Test::Run::Obj-new(
test_files = 
[
t/sample-tests/simple, 
t/sample-tests/head_end,
t/sample-tests/todo,
],
);

$tester-runtests();

open STDOUT, SAVEOUT;
close(SAVEOUT);
close(ALTOUT);

my $text = do { local $/; local *I; open I, , altout.txt; I};

# TEST
ok (($text =~ m/All tests successful/), 'All tests successful' (without 
the period) string as is);
}



t/test-failure-report.t:


#!/usr/bin/perl -w

BEGIN {
if( $ENV{PERL_CORE} ) {
chdir 't';
@INC = ('../lib', 'lib');
}
else {
unshift @INC, 't/lib';
}
}

use strict;
use File::Spec;

my $Curdir = File::Spec-curdir;
my $SAMPLE_TESTS = $ENV{PERL_CORE}
? File::Spec-catdir($Curdir, 'lib', 'sample-tests')
: File::Spec-catdir($Curdir, 't',   'sample-tests');


use Test::More tests = 1;;

my $IsMacPerl = $^O eq 'MacOS';
my $IsVMS = $^O eq 'VMS';

# VMS uses native, not POSIX, exit codes.
# MacPerl's exit codes are broken.
my $die_estat = $IsVMS ? 44 : 
$IsMacPerl ? 0  :
 1;

use Test::Run::Obj;


open ALTOUT, , altout.txt;
open SAVEOUT, STDOUT;
open STDOUT, ALTOUT;

my $tester = Test::Run::Obj-new(
test_files = [t/sample-tests/simple_fail]
);
eval {
$tester-runtests();
};

open STDOUT, SAVEOUT;
close(SAVEOUT);
close(ALTOUT);
my $text = do { local $/; open I, , altout.txt; I};
my $right_text = EOF;
t/sample-tests/simple_fail...FAILED tests 2, 5
Failed 2/5 tests, 60.00% okay
Failed TestStat Wstat Total Fail  Failed  List of Failed
---
t/sample-tests/simple_fail52  40.00%  2 5
EOF
# TEST
is ($text, $right_text, Testing for the right failure text);



They may use a little cleaning up, but they were still absent from 
Test::Harness. I believe I hit them when I accidently broke stuff, and then 
fixed them while adding these tests.

Regards,

Shlomi Fish

-
Shlomi Fish  [EMAIL PROTECTED]
Homepage:http://www.shlomifish.org/

95% of the programmers consider 95% of the code they did not write, in the
bottom 5%.


Re: Test::Run Output with a Coloured Summary Line

2005-11-29 Thread Tels
-BEGIN PGP SIGNED MESSAGE-

Moin,

On Tuesday 29 November 2005 23:28, Shlomi Fish wrote:
 Check:

 http://www.flickr.com/photos/[EMAIL PROTECTED]/68430623/

 This was done by using Test::Run::CmdLine's runprove (a yet-incomplete
 equivalent of Test::Harness' prove) and the
 Test::Run::CmdLine::Drivers::ColorSummary driver that is in fact a
 sub-class of Test::Run, my fork of Test::Harness.

Cool. make it green for success, red for failure? (Or slightly different 
colors in case the terminal renders this so close together that red-green 
blind people have problems) :)

Best wishes,

Tels

- -- 
 Signed on Tue Nov 29 23:48:26 2005 with key 0x93B84C15.
 Visit my photo gallery at http://bloodgate.com/photos/
 PGP key on http://bloodgate.com/tels.asc or per email.

 Q: What do you get when you cross an insomniac, an agnostic, and a
 dyslexic?
  A: Someone who stays up all night wondering if there is a Dog. --
 Groucho Marx

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (GNU/Linux)

iQEVAwUBQ4za83cLPEOTuEwVAQGCJwf9GJsXjfZ0U0HqGXmNk2r1r9NX9oBDxp5o
4NpjoBLaU+gq9Sd12zKR2lCmcmQtVGB9r2h/xp9GQ0On7xsYScLRWua1WUEhlcyw
Qi+fO95+PqhKk7R4Ffq3XuO+pAyOg/uRgxtoVUijoRPe1RPO7GMosUWcZjML4uzl
W2ZcV5WGnM5OzfsRgnqJmUXHiQzcNpi6yvq95IIhc7OeyRm1QoISzsTuir0QWw6F
J/gP6S2KjKwHoEoPeG/NwObBU1qMdNH8UD3MK1a99Y5sEGp2QX6dkK/QR6atiwi2
hRJVCDcupXsZr7VyLYn8U9orfRhn3sNduOcbFQXFoHNUSvaxjTFEvQ==
=36Gw
-END PGP SIGNATURE-


Re: Test::Run Output with a Coloured Summary Line

2005-11-29 Thread Shlomi Fish
Hi Tels! (and all)

On Wednesday 30 November 2005 00:49, Tels wrote:
 Moin,

 On Tuesday 29 November 2005 23:28, Shlomi Fish wrote:
  Check:
 
  http://www.flickr.com/photos/[EMAIL PROTECTED]/68430623/
 
  This was done by using Test::Run::CmdLine's runprove (a yet-incomplete
  equivalent of Test::Harness' prove) and the
  Test::Run::CmdLine::Drivers::ColorSummary driver that is in fact a
  sub-class of Test::Run, my fork of Test::Harness.

 Cool. make it green for success, red for failure? (Or slightly different
 colors in case the terminal renders this so close together that red-green
 blind people have problems) :)

At the moment, it's blue for success and red for failure. Green did not agree 
very well with my white terminal background. ;-) 

But I'd like to make the colours configurable by environment variables, etc. 
What I have now is just a proof-of-concept.

Regards,

Shlomi Fish

-
Shlomi Fish  [EMAIL PROTECTED]
Homepage:http://www.shlomifish.org/

95% of the programmers consider 95% of the code they did not write, in the
bottom 5%.