Last active
December 15, 2015 12:29
-
-
Save rjattrill/5260941 to your computer and use it in GitHub Desktop.
Unit Test Template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Test::More; | |
use v5.10; | |
use Carp; | |
use Try::Tiny; | |
use Data::Dumper; | |
use FindBin qw($Bin); | |
use FindBin::libs; | |
our $username = 'unit_test'; | |
BEGIN { | |
use_ok(MySpace::NewService); | |
} | |
SKIP: | |
{ | |
my $test = 'Setup'; | |
skip "Debugging", 1, if 0; | |
try { | |
say "Running $test"; | |
my $yaml = "$Bin/../../../data/MySpace/NewServiceUnitTestSet.yaml"; | |
ok(-e $yaml, "YAML file exists"); | |
my $s = MySpace::NewService->new(username => $username); | |
my $rc = $s->load_yaml($yaml); | |
ok($rc, "load_yaml"); | |
} catch { | |
carp($_); | |
fail($test); | |
} | |
} | |
SKIP: | |
{ | |
my $test = 'Next test'; | |
skip "Debugging", 1, if 0; | |
try { | |
... | |
} | |
} | |
done_testing(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See http://uvbit.blogspot.com.au/2013/03/template-for-perl-unit-tests.html for motivations / comments.