Help ensure changes did not affect other behavior • Makes integration testing easier • Code becomes “self documenting” ◦ Just look at the tests Unit Tests
ok( 1 + 1 == 2 ); ok( 2 + 2 == 5 ); Run the test: perl simple.t Produces: 1..2 ok 1 not ok 2 # Failed test (test.pl at line 5) # Looks like you failed 1 tests of 2. Perl Testing
are kept in folders called ‘t’ • Test files are named <something>.t ◦ 00-<test prerequisites>.t ◦ 10-<module name>.t ◦ 20-<module name>.t There aren’t “rules”, it’s Perl!! Perl Testing