I have been working with TAP to test environment and other things that are not code.
Did I win the lottery?
http://pl129.pairlitesite.com/tests/action/lottery.txt
http://pl129.pairlitesite.com/tests/action/lottery.t
Is my server up?
http://pl129.pairlitesite.com/tests/action/ping.txt
http://pl129.pairlitesite.com/tests/action/ping.t
etc.
I have been running these with cron and I get email about the results. Well the trouble is when I have failing tests I want to see if the tests are still failing. I was in a place that was blocking ssh traffic. So it lead me to this solution.
I wrote a little prove wrapper.
#!/usr/local/bin/perl
use CGI;
my $q = new CGI;
print $q->header;
print $q->start_html('prove');
my $file = $q->param('file');
my $ok_file = {
'/tests/action/ping.t' => 1,
'/tests/action/lottery.t' => 1,
};
my $out;
if ( $ok_file->{$file} ) {
my $command = "/usr/home/pl129/public_html/bin/prove/usr/home/pl129/public_html$file 2>&1";
$out = `$command`;
} else {
$out = "<pre> $file not allowed </pre>";
}
print $q->h1($file);
print "<hr>";
print "<pre>$out</pre>";
print $q->end_html;
I added this to my
AddHandler prove-type
.t
Action prove-type/bin/proveit.cgi?v=1&file=
So know I can link to my tests:
http://pl129.pairlitesite.com/tests/action/ping.t
So I often wonder if a website is hosted at http://pair.com/ or not.
Well it is rather is to figure that out. If you have http://www.mozilla.com/en-US/firefox/ and http://greasemonkey.mozdev.org/ installed.
And this little greasemonkey script
http://www.robertblackwell.com/grease/ispair/ispair.user.js
http://www.robertblackwell.com/grease/ispair/ispair.user.js.txt
I am working on collecting examples of using TAP and TAP tools like prove to test things other than code. I hope to use these examples in a future talk.
I think that using TAP can be very effective in testing many situations.
I trust someone out there will have some very interesting examples.
Some examples:
use Test::More qw( no_plan );
use Test::WWW::Mechanize;
my $mech=Test::WWW::Mechanize->new();
my $uri = 'http://www.southsideworks.com/showtimes.htm';
$mech->get_ok( $uri );
$mech->content_contains( "The Prestige", "Desc " );
$mech->content_contains( "Elephant's Dream", "Desc " );
#!/usr/local/bin/perl
use Test::More qw( no_plan );
my $command = `ping -o robertblackwell.com`;
like ($command , qr/216.146.203.240/ );
*Special Gathering*
Please join us for a special meeting with Damian Conway.
Please watch http://pgh.pm.org/ further details.
*Location*
CMU
Wean Hall Room 7500
Pittsburgh, PA
Driving Directions
http://www.cmu.edu/home/visitors/directions.html
Campus Directions
http://www.cmu.edu/home/visitors/map/
Saturday, October 29, 2005
18:30
*Talk*
* Sufficiently Advanced Technologies - Damian Conway *
In module design, interface is everything. Going one step beyond this dictum, Damian demonstrates
and explains several practical applications of Clarke's Law ("Any sufficiently advanced technology
is indistinguishable from magic") by presenting a series of useful modules whose interface
is...nothing.
*Damian Conway*
Damian Conway holds a Ph.D. in Computer Science and is an Associate Professor with the School
of Computer Science and Software Engineering at Monash University, Melbourne, Australia.
A widely sought-after speaker and trainer, he is also the author of numerous well-known
software modules including: Parse::RecDescent (a sophisticated parsing tool), Class::Contract
(design-by-contract programming in Perl), Lingua::EN::Inflect (rule-based English transformations
for text generation), Class::Multimethods (multiple dispatch polymorphism), Text::Autoformat
(intelligent automatic reformatting of plaintext), Switch (Perl's missing case statement), NEXT
(resumptive method dispatch), Filter::Simple (Perl-based source code manipulation),
Quantum::Superpositions (auto-parallelization of serial code using a quantum mechanical metaphor),
and Lingua::Romana::Perligata (programming in Latin). All of this software is available free from
your local CPAN mirror.
A well-known member of the international Perl community, Damian was the winner of the 1998,
1999, and 2000 Larry Wall Awards for Practical Utility. The best technical paper at the annual
Perl Conference was subsequently named in his honour. He is a member of the technical committee
for The Perl Conference, a keynote speaker at many Open Source conferences, a former columnist for
"The Perl Journal", and author of the book "Object Oriented Perl". In 2001 Damian received the
first "Perl Foundation Development Grant" and spent 20 months working on projects for the
betterment of Perl.
Currently he runs an international IT training company – Thoughtstream – which provides
programmer training from beginner to masterclass level throughout Europe, North America, and
Australasia.
Most of his time is currently spent working with Larry Wall on the design of the new Perl 6
programming language and producing explanatory documents exploring Larry's design decisions.
Other technical areas in which he has published internationally include programming language
design, programmer education, object orientation, software engineering, natural language
generation, synthetic language generation, emergent systems, declarative programming, image
morphing, human-computer interaction, geometric modelling, the psychophysics of perception,
nanoscale simulation, and parsing.
Hope to see you there.
This is cool
JSSh - a TCP/IP JavaScript Shell Server for Mozilla
JSSh is a Mozilla C++ extension module that allows other programs (such as telnet) to establish JavaScript shell connections to a running Mozilla process via TCP/IP. This functionality is useful for interactive debugging/development of Mozilla applications, remotely controlling Mozilla, or for automated testing purposes.