home of szabgab
About
Contact
Keywords
Archive
!=
$0
$_
$a
$b
$|
%SIG
(?< name >...)
*
+
-d
-e
-v
.
..
//
1;
5.010
5.10
<
<$fh>
<=
<=>
==
=cut
=head1
=head2
=pod
>
>=
>>
@EXPORT_OK
@INC
[]
\k< name >
^
__WARN__
abs_path
ack
any
append
array
bareword
case
close
cmp
context
copy
cp
CPAN
CSV
Cwd
Dancer
Data::Dumper
DBD::SQLite
DBI
debug
declaration
default
defined or
del
delete
die
dirname
distinct
documentation
download
duplicate
editor
email
Email::Send::SMTP::Gmail
eq
Exporter
ExtUtils::MakeMaker
File::Basename
File::Open
File::Open::OOP
filter
flip-flop
fopen
for
foreach
function
ge
given
gmtime
grep
gt
HTTP::Server::Simple
HTTP::Server::Simple::CGI
IDE
implode
index
install
int
integer
join
lc
le
length
lib
LIST
List::MoreUtils
local
localtime
loop
lt
map
Moose
move
mv
my
named capture
ne
object oriented
ok
one-liner
OOP
oopen
open
open or die
our
package
Padre
perl
PERL5LIB
Perl::Critic
Perl::Critic::Bangs
perldoc
PERLLIB
Plack
plackup
POD
print
PSGI
rand
random
range
regex
remove
rename
REPL
return
rm
say
SCALAR
size
smart match
Smolder
sort
splice
split
SQL
state
strict
sub
subroutine
substr
SVG
switch
symbolic references
TAP
TAP::Formatter::HTML
Test::Harness
Test::Simple
testing
Text::CSV_XS
time
Time::HiRes
topic
uc
undef
uninitialized value
uniq
unique
unlink
use
use vars
v5.10
vars
warnings
WebService::GData
WebService::GData::YouTube
when
while
while (1)
write
x
YouTube
~~
Perl Tutorial
Test Automation
Perl Training
Automatic Testing with Perl
Gabor Szabo
Copyright © 2004, 2005, 2006, 2007 PTI Ltd. Perl Training Israel,
http://www.pti.co.il/
Table of Contents
1.
About Perl Training Israel
2.
Introduction
2.1.
Self Introduction - Who am I ?
2.2.
Self Introduction - Who are you ?
3.
Preface
3.1.
Objectives
3.2.
Plan of the seminar
4.
Manual testing
4.1.
Manual testing
4.2.
Web site testing
4.3.
CLI testing
4.4.
Database testing
4.5.
GUI testing
5.
Basic Testing Framework in Perl
5.1.
Testing a simple command line tool
5.2.
Calculator test
5.3.
Error !
5.4.
Calculator test with expected results
5.5.
More difficult output
5.6.
Print only ok/not ok
5.7.
Write the ok function
5.8.
Introducing Test::Simple
5.9.
Add names to the tests
5.10.
Enlarge our test suit
5.11.
Load Test::Simple at run time
5.12.
Forget about your "plan", use "no_plan"
5.13.
Put the test cases in an external file
5.14.
Harness
5.15.
Move external call into function
5.16.
Exercises: MyCalc
5.17.
Solution: MyCalc
5.18.
Test::Simple
6.
Test::More
6.1.
Moving over to Test::More
6.2.
Test::More ok( trueness, name);
6.3.
Test::More is( value, expected_value, name);
6.4.
diag(just_a_message );
6.5.
like(value, qr/expected regex/, name);
6.6.
cmp_ok( this, op, that, name);
6.7.
is_deeply( complex_structure, expected_complex structure, name);
6.8.
TODO
6.9.
TODO with Harness
6.10.
Platform dependent tests
6.11.
SKIP some tests
6.12.
My own test functions
6.13.
My own test functions - improved
6.14.
Create a test module
6.15.
Test::Builder
6.16.
Number of tests
6.17.
Early Abnormal Exit
6.18.
Less than planned tests - Early Normal Exit
6.19.
More tests than planned
6.20.
Multiply
6.21.
Error in the test
6.22.
Multiply - fixed
6.23.
Multiple expected values
6.24.
Exercises
7.
Command line application
7.1.
bc - An arbitrary precision calculator language
7.2.
Normal operation
7.3.
Expect.pm
7.4.
Simple computation - adding two values
7.5.
Results
7.6.
Simple computation - separate send commands
7.7.
Simple computation - is it really working ?
7.8.
Results
7.9.
Reduce output
7.10.
Output
7.11.
More than one test
7.12.
Output
7.13.
External test file
7.14.
Random regression tests
7.15.
Random and regression testing
7.16.
Random and regression testing - slight improvement
7.17.
Results
7.18.
Recording session
7.19.
Capturing both STDOUT and STDERR
7.20.
Capturing both STDOUT and STDERR manually
7.21.
Capturing both STDOUT and STDERR using IPC::Run3
8.
Networking devices
8.1.
Introduction - pick the right abstraction level
8.2.
Socket level programming using Socket.pm
8.3.
Socket level programming using IO::Socket
8.4.
Newline
8.5.
Net::Telnet
8.6.
Net::Telnet for HTTP
8.7.
Net::Telnet configure VLAN
8.8.
ftp using Net::FTP
8.9.
ssh using Net::SSH
8.10.
LWP::Simple
8.11.
LWP
8.12.
WWW::Mechanize
8.13.
WWW::GMail
8.14.
Exercise: CNN Developing story
8.15.
Exercise: Search on Financial Times
8.16.
Exercise: Compare exchange rates
8.17.
Telnet to Unix machines
9.
Servers
9.1.
Net::Server
9.2.
Skeleton Server
9.3.
Simple Echo Server
9.4.
Echo Server
9.5.
Complex network servers
10.
Command Line Interface
10.1.
Introduction
10.2.
Connect to the device
10.3.
Reduce timeout
10.4.
Exercise: Telnet
10.5.
Our test script
11.
Testing networking devices
11.1.
Elements
11.2.
Hardware setup
11.3.
Access the administrative interface
11.4.
Configure devices on all sides of our box
11.5.
Run tests
11.6.
Check results
11.7.
Expect.pm
11.8.
Other modules
11.9.
Networking
11.10.
Network devices
11.11.
Devices connected to Serial or Parallel port
11.12.
X10 protocol
12.
Web Applications
12.1.
What can be tested ?
12.2.
Tools
12.3.
Small test HTTP server
12.4.
Fetching a static page
12.5.
Fetching a not-existing static page
12.6.
Checking good HTML
12.7.
Checking bad HTML
12.8.
What is this bad HTML ?
12.9.
HTML::Tidy and Test::HTML::Tidy
12.10.
Test using W3C validator
12.11.
LWP::Simple and LWP
12.12.
WWW::Mechanize
12.13.
Web based Calculator
12.14.
More things to test
12.15.
Test page with JavaScript
13.
Database access using Perl DBI
13.1.
Architecture of a DBI Application
13.2.
Create Sample Database
13.3.
Connect to database
13.4.
SELECT with one result
13.5.
SELECT with more results
13.6.
SELECT, prepare with placeholders
13.7.
SELECT, using hashref
13.8.
INSERT
13.9.
Sample database
13.10.
Other methods
13.11.
Attributes
13.12.
Error handling
13.13.
Debugging (Trace levels)
14.
Database access using Class::DBI
14.1.
Class::DBI
14.2.
INSERT using Class::DBI
14.3.
SELECT using Class::DBI
14.4.
MyDBI and MyUsers
List of Examples
5-1.
mycalc on the command line
5-2.
examples/intro/t01_calc.t
5-3.
examples/intro/t01_calc.out
5-4.
examples/intro/t02_calc.t
5-5.
examples/intro/t02_calc.out
5-6.
examples/intro/t03_calc.t
5-7.
examples/intro/t03_calc.out
5-8.
examples/intro/t04_calc.t
5-9.
examples/intro/t04_calc.out
5-10.
examples/intro/t05_calc.t
5-11.
examples/intro/t05_calc.out
5-12.
examples/intro/t09_calc.t
5-13.
examples/intro/t09_calc.out
5-14.
examples/intro/t10_calc.t
5-15.
examples/intro/t10_calc.out
5-16.
examples/intro/t11_calc.t
5-17.
examples/intro/t12_calc.t
5-18.
examples/intro/t12_calc.out
5-19.
examples/intro/t13_calc.t
5-20.
examples/intro/calc.txt
5-21.
examples/intro/t13_calc.out
5-22.
examples/harness.pl
5-23.
examples/intro/t13_calc.harness.out
5-24.
examples/intro/t14_calc.t
5-25.
examples/intro/mycalc_test.t
6-1.
examples/intro/t21_calc.t
6-2.
examples/intro/t22_calc.t
6-3.
examples/intro/like.t
6-4.
examples/intro/cmp_ok.t
6-5.
examples/intro/is_deeply.t
6-6.
examples/intro/is_deeply.out
6-7.
examples/intro/t23_calc.t
6-8.
examples/intro/without_skip.t
6-9.
examples/intro/skip.t
6-10.
examples/intro/Test/MyTest.pm
6-11.
examples/intro/early-abnormal-exit.t
6-12.
examples/intro/early-normal-exit.t
6-13.
examples/intro/too-many-tests.t
6-14.
examples/intro/t24_calc.t
6-15.
examples/intro/t25_calc.t
6-16.
examples/intro/multiple_choice.t
7-1.
examples/bc/bc1.pl
7-2.
examples/bc/bc2.pl
7-3.
examples/bc/bc3.pl
7-4.
examples/bc/bc4.pl
7-5.
examples/bc/bc5.pl
7-6.
examples/bc/bc5a.pl
7-7.
examples/bc/bc6.pl
7-8.
examples/bc/bc7_diff.pl
7-9.
examples/expect/record.pl
7-10.
examples/io/capture.pl
7-11.
examples/io/capture_ipc.pl
8-1.
examples/network/socket.pl
8-2.
examples/network/io_socket.pl
8-3.
examples/telnet/telnet.pl
8-4.
examples/telnet/telnet_http.pl
8-5.
examples/telnet/configure_vlan.pl
8-6.
examples/network/upload.pl
8-7.
examples/network/ssh.pl
8-8.
examples/network/lwp_simple.pl
8-9.
examples/network/lwp.pl
8-10.
examples/network/mechanize.pl
8-11.
examples/network/gmail.pl
9-1.
examples/server/skeleton_server.pl
9-2.
examples/server/lib/SkeletonServer.pm
9-3.
examples/server/simple_echo_server.pl
9-4.
examples/server/lib/SimpleEchoServer.pm
9-5.
examples/server/echo_server.pl
9-6.
examples/server/lib/EchoServer.pm
10-1.
examples/cli/cli_01.pl
10-2.
examples/cli/cli_02.pl
10-3.
examples/cli/cli.t
12-1.
examples/www/static.t
12-2.
examples/www/static_bad.t
12-3.
examples/www/static_lint.t
12-4.
examples/www/static_lint_bad.t
12-5.
examples/www/server/html/bad.html
12-6.
examples/www/static_tidy.t
12-7.
examples/www/web_calc.t
13-1.
examples/dbi/connect.pl
13-2.
examples/dbi/select.pl
13-3.
examples/dbi/select_name.pl
13-4.
examples/dbi/select_with_placeholders.pl
13-5.
examples/dbi/select_hashref.pl
13-6.
examples/dbi/insert.pl
13-7.
examples/dbi/create_sample.pl
13-8.
examples/dbi/sample.sql
14-1.
examples/cdbi/insert.pl
14-2.
examples/cdbi/select.pl
14-3.
examples/cdbi/MyDBI.pm
14-4.
examples/cdbi/MyUsers.pm
Next
About Perl Training Israel
If you are interested in on-site trainings by the author, please
contact me
directly.
Perl Weekly
A FREE newsletter
Click here to sign-up
Online courses:
Beginner
Perl Maven
Advanced
Perl Maven
Free
Perl Maven
Cookbook
Would you like to get
updated when I publish
the next article?
Follow me:
Via e-mail: