Testing the address book requires some techniques that we didn't need for ChatStat. Most of the AddressBook is hidden behind a login screen, so we'll have to log in for testing the application. It also requires us to fill out a lot of forms. Finally, it has a JavaScript interface that we can't test without a live web browser. In this section, we'll see how to test those parts of the application.
We'll start by adding a test database module to AddressBook. This is almost an exact copy of the one we created for ChatStat, but we add a convenience function for creating a test user and logging in as that user:
package AddressBook::Test::Database::Live; use strict; use warnings; use AddressBook::Schema::AddressDB; use Directory::Scratch; use YAML qw(DumpFile); use FindBin qw($Bin); use base 'Exporter'; our @EXPORT = qw/log_in schema/; my $schema; my $config; BEGIN { my $tmp = Directory::Scratch->new; my $db = $tmp->touch('db'); my $dsn = "DBI:SQLite...