Functional
Non-functional
Performance
Load
Usability
Security
Localisation
Unit
Integration
UI
Regression
Smoke
Exploratory
End-to-end
Acceptance
Perl has a history of testing
Perl version 1 included tests
Most CPAN modules include tests
Modules tests are run upon installation
CPANTesters
Test Anything Protocol
1..4
ok 1 - Input file opened
not ok 2 - First line of the input valid
ok 3 - Read the rest of the file
not ok 4 - Summarised correctly # TODO - not written yet
1..4
ok 1 - Input file opened
not ok 2 - First line of the input valid
ok 3 - Read the rest of the file
not ok 4 - Summarised correctly # TODO - not written yet
1..4
ok 1 - Input file opened
not ok 2 - First line of the input valid
ok 3 - Read the rest of the file
not ok 4 - Summarised correctly # TODO - not written yet
1..4
ok 1 - Input file opened
not ok 2 - First line of the input valid
ok 3 - Read the rest of the file
not ok 4 - Summarised correctly # TODO - not written yet
1..4
ok 1 - Input file opened
not ok 2 - First line of the input valid
ok 3 - Read the rest of the file
not ok 4 - Summarised correctly # TODO - not written yet
1..4
ok 1 - Input file opened
not ok 2 - First line of the input valid
ok 3 - Read the rest of the file
not ok 4 - Summarised correctly # TODO - not written yet
Producer
Consumer
you
Test::Harness
make test
prove
Test2::Harness
yath
#!/usr/bin/env perl
use Reader;
say "1..2";
my $reader = Reader->new("test_data");
print "not " unless $reader;
say "ok 1 - Input file opened";
my $first_line = $reader->read;
print "not " unless $first_line eq "START";
say "ok 2 - First line of input valid";
#!/usr/bin/env perl
use Test;
use Reader;
BEGIN { plan tests => 2 }
my $reader = Reader->new("test_data");
ok $reader;
my $first_line = $reader->read;
ok $first_line, "START", "First line of input valid";
#!/usr/bin/env perl
use Test::Simple tests => 2;
use Reader;
my $reader = Reader->new("test_data");
ok $reader, "Input file opened";
my $first_line = $reader->read;
ok $first_line eq "START", "First line of input valid";
#!/usr/bin/env perl
use Test::More tests => 2;
use Reader;
my $reader = Reader->new("test_data");
ok $reader, "Input file opened";
my $first_line = $reader->read;
is $first_line, "START", "First line of input valid";
#!/usr/bin/env perl
use Test::Most tests => 2;
use Reader;
my $reader = Reader->new("test_data");
ok $reader, "Input file opened";
my $first_line = $reader->read;
is $first_line, "START", "First line of input valid";
package Reader::Test;
use base qw( Test::Class );
use Test::More;
use Reader;
sub make_fixture : Test(setup) {
shift->{reader} = Reader->new("test_data");
}
sub reader : Test(2) {
my $reader = shift->{reader};
ok $reader, "Input file opened";
my $first_line = $reader->read;
is $first_line, "START", "First line of input valid";
}
#!/usr/bin/env perl
use Reader::Test;
Test::Class->runtests;
package TestFor::Reader;
use Test::Class::Moose;
use Reader;
has reader => is => "ro", isa => "Reader";
sub test_setup { shift->reader(Reader->new("test_data")) }
sub test_reader {
my $reader = shift->reader;
ok $reader, "Input file opened";
my $first_line = $reader->read;
is $first_line, "START", "First line of input valid";
}
#!/usr/bin/env perl
use Test::Class::Moose::CLI;
Test::Class::Moose::CLI->new_with_options->run;
#!/usr/bin/env perl
use Test2::Bundle::More;
use Reader;
plan 2;
my $reader = Reader->new("test_data");
ok $reader, "Input file opened";
my $first_line = $reader->read;
is $first_line, "START", "First line of input valid";
Opinion is divided on the subject
It's just a test
Tests are code too
(Your test code should be simpler
than the code it is testing, yes?)
Test.pm
Test::Simple
Test::More
Test::Most
Test::Class
Test::Class::Moose
Test2
Coverage
Time
Run them in parallel
Profile
Test::Class
DRY
Testing at the wrong level
Testing at the wrong level
UI tests instead of Unit tests
Units tests tightly coupled to implementation rather than API